From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.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 E13031C460E for ; Fri, 22 Nov 2024 09:13:13 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266795; cv=none; b=K29MpV8L71LzGDgvwQzo9J65zMDXNd+c2PxtPlkL2emvSj6kZPebm9r+k69cY9kSAAnBSxbSZxWcZ8auSe/V5BJGhJIw6VY+OXqvxJ6amECrXobdiiCZmHPi7dXe8hcGHAlhEWWq9ySCg6DkRKvlimnMMyPMaDY713gFdZ3g/3Y= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266795; c=relaxed/simple; bh=cHHtfh9y6/Xe5pWD0imwgSoaSzh5tOQpdFVxQZ5xP/s=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=WsqifhVyMJ5L/sX9AGQ5niY/m8zUcgqS9sGsx5CERbYyEeK1bDmAd8I1Dy3kIId/kBH0wggn36W0uLHpjCNcU+v5JEfB/Jq4ieVRvpRSg5P+sFguPeQmNO7X4JYjEsAemhIB6x76OTrHz/XZxiWSRTZ9CtjY4qDOQEkXCxkGSK8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=cwmuxVM9; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="cwmuxVM9" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-539e63c8678so2076597e87.0 for ; Fri, 22 Nov 2024 01:13:13 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266792; x=1732871592; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=6W3bqmSBPUsE+fVjxjecsCfWlJC1+mE/7mRAcZKJqvU=; b=cwmuxVM9XP1QccMFJGTwlDwmYfzc2k8QZ5bD/+19jLZQrLHrxLc0T83woBp6mPrQ8W 3bASFPltppPVZvbbrQRQDPmyM/9XRMLIdVrP2jZHlxOkQgm+QgOpkR+mnbfRLVhlGWeh t+00zvF5OojkT8hpiGHplq8n2DjSKUZmpGPa+fR8nW1jvhKNDV0o6NHI86poqNpDQxEZ 0/5iACRPMFNPQpwYio8c79jJL9do1dxcLRuuGfTpt7Z0hZCRLY6N5dQVFW2zOkVA8nqb pnL5s45Uf1Xkp8jR1ubO9B7zGAG5UUXFExkNsHl4YHFAPeSWcneLiBdTOx3OeGDoko9n ShBQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266792; x=1732871592; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=6W3bqmSBPUsE+fVjxjecsCfWlJC1+mE/7mRAcZKJqvU=; b=J1ZElfUWHCMYjYKZcfALMBLuE3IH3N5szGpxnvtz6zn3dltFBuGRwrOv3RHBzb4STo oYbg6ea4NnNsIyZWC2bUStSh7RS+BA2da3rP2vpACI4vMnJpVLso4PKMyeVhZM+GLIAi A7SPOnpjCXXN40SjkAANRSrigkz0fJ7PYI7FH++XeSHCFEA/CeztNIjCtruYW7bydV1j yyBlT/hD+4B0I4kiFurafEsnlt8E2Jds7QEw/TyjitcHtPx/o/BPwRUtowoDPwNoisPp xwXbXPNewE9V2fAPU0tB9DptgDrM7FgsiNZbMjya+08685OVYlLFBuXSKboaxPjqqniO f0Ew== X-Forwarded-Encrypted: i=1; AJvYcCXqXhZVSp7znh6cXsmzRSON89Q4uaQ3aLyzanQzJNtc8Xlwz7AsBvBIRQhoN5diARYBquscC1aOE+2F9JE=@vger.kernel.org X-Gm-Message-State: AOJu0YxPKXJ6kfzhDtk/jk5jrBdlqOcdjPW3iGtcQkCq3sIpJmZq+8jv IvYHH1dG0I54iXzAYR/dE29zQ81d2toeaKZWD22H5MPo5Fz47PzQOX/99+WxCAOjZL8XNZz5AFw 8 X-Gm-Gg: ASbGnctkvANEqMhWZNGm4QaCBxz8BxwVx6vN4ShRqt3Xdos/r2IA6wJjOeH0HZ+svwm JDGLPeAnPl+f4hi6RzNggaATwJGDwMwFKB92B8gUnvcUQmmDjjcvKzhTnp7srL2lpATIoxbSj5Z t0bbB3YPfPcB2bmsAAKJUXTZXGgsHgdfPTssJwdytr1FVeYQGkNZ/Lk4hR016UMNzIqCRHdQK7N s5NRHrNctM+9jjxe6EQcnau4RZTIKBBEIuI8DMhUVJWiGBaY7YkachnBw== X-Google-Smtp-Source: AGHT+IF9ThfWnsEQI6UyED7pA9h6Wf7FpGWyg1saUJdib/WRVSKuqZ2ksQYV61QNiecHx3mAhZLedA== X-Received: by 2002:ac2:568f:0:b0:53d:a024:ddb2 with SMTP id 2adb3069b0e04-53dd37a6c3bmr1142300e87.24.1732266791780; Fri, 22 Nov 2024 01:13:11 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.09 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:10 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:57 +0200 Subject: [PATCH v4 01/10] drm/tests: hdmi: handle empty modes in find_preferred_mode() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-1-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1147; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=cHHtfh9y6/Xe5pWD0imwgSoaSzh5tOQpdFVxQZ5xP/s=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshW4nqOdXL0T4IVeWcFtdcIU865J/geaZOs dJST3YPq1iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1aCMB/4mAMbVULeSJaQKgD/thf0SdySNUWeV6CvGlRgfogZod1ZMqfju5iE0YiqI7xy28Ycv74E B0vuUvxyNt+MKQbKrGS8BTlEhjMqCpiI/CHQBw9F6k2HpfGFkrWHDIoMHaaoW5DaERqX6xacG/s DhPpiLyKV55OciJGf0cj7Okd9I+OzcIvE3aVDAo8uG6emEXX0UO2hya4rXHN74Rwop72ki1rJn+ 7Co2fSv5VYDWughxDBVCLzuLe6u6WeSCbhxlSg97MXogFyunITxmcV5RlLk5Z5TQWDhuX4634jq pnHjEf3jhAkLQer5IkvtUgJ1d8uMHBw5CJY0WH/gX/wWSOgj X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A If the connector->modes list is empty, then list_first_entry() returns a bogus entry. Change that to use list_first_entry_or_null(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 294773342e710dc56772f839c2db9c2e487bbc1e..1e77689af6549f162eb3026c7bd= 2bbd59516ed98 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -46,7 +46,7 @@ static struct drm_display_mode *find_preferred_mode(struc= t drm_connector *connec struct drm_display_mode *mode, *preferred; =20 mutex_lock(&drm->mode_config.mutex); - preferred =3D list_first_entry(&connector->modes, struct drm_display_mode= , head); + preferred =3D list_first_entry_or_null(&connector->modes, struct drm_disp= lay_mode, head); list_for_each_entry(mode, &connector->modes, head) if (mode->type & DRM_MODE_TYPE_PREFERRED) preferred =3D mode; --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.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 94FF81D799D for ; Fri, 22 Nov 2024 09:13:16 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266798; cv=none; b=nqYSyAvqqsIG8Y3zTWmhkDYPG1O+ur7E2cw0ZJPWXwNvojMuQ6DHBhwxhkR4ewO1bj0ou2P6h83mOMdwx4RWDeeoiZlDZk0l6b6ApiPlqdfcehSphvPDSrKqe0DyDi+Pu3WCX0dT9hss4ST/2b7CmzA4+Isoory1SPPU1suslzo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266798; c=relaxed/simple; bh=g90UV4snbYK1PCsg8Vi4l6YeLj+54jyCttfyA/beoL8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Kzvfgf/XN6kNkIoudztPxJmRDzaamXfoUx3+tyfleix/9CKenjU9HDpgQqFy5LDesIpMuXvSu+BhYheGKSrAZI7chXp4OExyX/04XXK5WVkqEmw/YcVYhF0rdgDfdm9Chn+vQLU49rNJ2MfNY2OBQlYWpU0V7KNgKX6gXAqdxRc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=lo4XKYKI; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="lo4XKYKI" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-53da5a27771so2162899e87.2 for ; Fri, 22 Nov 2024 01:13:16 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266794; x=1732871594; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=HoL3aWMtjL9qLbqtGe43c2BpbewS4aE5M6KHnAUYZyA=; b=lo4XKYKI14TuY9Oa5RhkrXTcvMhCfs1y8RQ0FMJntPlI4y/LQ8EDlvNZBHZrxiRi2g OjlhgrFr3hIRNv+/0Fak03o9M4ZvC6Ox/8YofHd4W+I88z2UGz0jIESZsbc2D4iv1Dov 5objygzhKDlQOszHiuTZ+Q2G7mSApe1su0DDjA7pdmC+6UAjknaIX+KME40mSKB01S82 7iCEhsPKViB6V3IjXO+NyMuS7lBPuQUHZgmj32J5eZEX60rViVXKnzwp/oko9prVoroM JKrfZk9mPyfYOpJ0yQcMvNPi7IDOxnuDwJc+Z+PeG6wtCy0HlHRivXwxApCrPLjCF7iu r9DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266794; x=1732871594; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=HoL3aWMtjL9qLbqtGe43c2BpbewS4aE5M6KHnAUYZyA=; b=pU1DVb+iRz8y8/OfA+Kfz23CiihJsRXNMAlj8W/3cnUY5LJu3yAiLXhFyPt5Ut8Fdg S+mdicyFABgayw/Hv7R4dKj6pEpu6DZYwMY/Z9OPMGglMbqOKtqHnwgTMRpPwIV1vaD0 16Qv/jhFne85sLwnQG5nY3pDm0f4V70c0ZPiYdGyeyF3TgHhnLBKiez8fU95cPkqq/BI hSWEaoB785HGgei68EVuF9/t1Re24Hb/9i49Ct1pal9ugVspqBU42nn8ZOfQRsPG+Jxk 3lQhbKJIFgZ6uFZpxV52zb8T1sv5nIqHTX0gSKUGvEk8u3HYVwCMjEvwAIBZ3WApa+ck u4aQ== X-Forwarded-Encrypted: i=1; AJvYcCVsSRqQOu5Tc5qkOQlv5yTs85X0kzshUUGSEG+Z09L+U+cdsv4X+vNXKV4RlK6q+vlLq99vJQVRCqca9c0=@vger.kernel.org X-Gm-Message-State: AOJu0Yw18kCdq5beAfvKu4Mwr6ZT8yUsA7xAI5rc832JWG+PvzLCjd7m bPwTz5pmGkCOj0v9P3dQ+EVagnFyU73c5T13RwH6L7MUfkKLs1QSugj69EjG/i/E75+UJcgo+cn u X-Gm-Gg: ASbGncv3RlOq1eDkXrqdj7WvZY2QpgPFfUd1a9FuD9rBSj1lwD5/kSb4al2mTvEDcb3 tExI6NAOZEezkO2oS+j3iy6zbJKs6PTiU2Olle5SrS3gp7K4X6fugeGpKAkFbrBe4sQgGPqu3a8 908bX79ipFQl5uUye9w+hzUoTIO6B4MXx/wzJrsWxdvfw6TZYeUSTBcrcJZi4IZ84fs37b80Goa 1bqLwF8oDYaC9VE3XW0Pw6UxC9FM6vO9fIAMRStHlDCAjqc3N6bfI81QA== X-Google-Smtp-Source: AGHT+IGsVNjOq27k776zE/cKgwN70tM6uYhT0eEceng2yr5gRWog07KJFnzoL9IEms+6bvRWR289/w== X-Received: by 2002:a05:6512:b8a:b0:53d:d2d0:7c8f with SMTP id 2adb3069b0e04-53dd389d8c5mr910882e87.34.1732266794264; Fri, 22 Nov 2024 01:13:14 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:12 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:58 +0200 Subject: [PATCH v4 02/10] drm/tests: hdmi: rename connector creation function Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-2-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=11003; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=g90UV4snbYK1PCsg8Vi4l6YeLj+54jyCttfyA/beoL8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshr58WmNMo81MG4tiQNHQeSCPOdq5T4NQZ4 z8ZTDVJEraJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1fMGB/9ZOhAOQVgQ06z4Dsew8aMKvh7Gsx2b8vApxlPuSYhFhnespRjpeyhSCxW5AAYYPlS87N3 OpezjjaXuXIKqiV1jqN8LW1Mdu4T94LRA30YeLbaImenTe4zJULUTIPgSb0YhDqlBtKMplZ+ztr xZa14xzq/fyMB1B0/kW6cpcS8Aija2dpwz7SD2cUXZ+WnR2224RqWvRC5r+3Yh3JTatsclMYRqT zFyZjeJDH8l2dK/pK7ipe0HJbkZdttc3WuNvlFBXzitXJaNC1t8gP7mfTF4ENXVC6Tna2YUX3un gPH6KVG+TF4XJf8zdGy9/ks9y9P+2SD6uG+UcQHbET/Akc4+ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A As pointed out by Maxime, the drm_atomic_helper_connector_hdmi_init() isn't a good name for a function inside KUnit tests. Rename it to drm_kunit_helper_connector_hdmi_init(). Suggested-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 58 +++++++++++-------= ---- 1 file changed, 29 insertions(+), 29 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index 1e77689af6549f162eb3026c7bd2bbd59516ed98..d81254d46975e8af0d782249928= 217a1ebb7646e 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -164,7 +164,7 @@ static const struct drm_connector_funcs dummy_connector= _funcs =3D { =20 static struct drm_atomic_helper_connector_hdmi_priv * -drm_atomic_helper_connector_hdmi_init(struct kunit *test, +drm_kunit_helper_connector_hdmi_init(struct kunit *test, unsigned int formats, unsigned int max_bpc) { @@ -247,7 +247,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_chan= ged(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -310,7 +310,7 @@ static void drm_test_check_broadcast_rgb_crtc_mode_not_= changed(struct kunit *tes struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -373,7 +373,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode(= struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -429,7 +429,7 @@ static void drm_test_check_broadcast_rgb_auto_cea_mode_= vic_1(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -485,7 +485,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode(= struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -543,7 +543,7 @@ static void drm_test_check_broadcast_rgb_full_cea_mode_= vic_1(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -601,7 +601,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mo= de(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -659,7 +659,7 @@ static void drm_test_check_broadcast_rgb_limited_cea_mo= de_vic_1(struct kunit *te struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -719,7 +719,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed= (struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -793,7 +793,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_cha= nged(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -862,7 +862,7 @@ static void drm_test_check_output_bpc_dvi(struct kunit = *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -911,7 +911,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(stru= ct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -958,7 +958,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(str= uct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1005,7 +1005,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(s= truct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1056,7 +1056,7 @@ static void drm_test_check_hdmi_funcs_reject_rate(str= uct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1112,7 +1112,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback= (struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1179,7 +1179,7 @@ static void drm_test_check_max_tmds_rate_format_fallb= ack(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1242,7 +1242,7 @@ static void drm_test_check_output_bpc_format_vic_1(st= ruct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1305,7 +1305,7 @@ static void drm_test_check_output_bpc_format_driver_r= gb_only(struct kunit *test) struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1370,7 +1370,7 @@ static void drm_test_check_output_bpc_format_display_= rgb_only(struct kunit *test struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1438,7 +1438,7 @@ static void drm_test_check_output_bpc_format_driver_8= bpc_only(struct kunit *test struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1496,7 +1496,7 @@ static void drm_test_check_output_bpc_format_display_= 8bpc_only(struct kunit *tes struct drm_crtc *crtc; int ret; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1593,7 +1593,7 @@ static void drm_test_check_broadcast_rgb_value(struct= kunit *test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1615,7 +1615,7 @@ static void drm_test_check_bpc_8_value(struct kunit *= test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 8); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1639,7 +1639,7 @@ static void drm_test_check_bpc_10_value(struct kunit = *test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 10); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1663,7 +1663,7 @@ static void drm_test_check_bpc_12_value(struct kunit = *test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB), 12); KUNIT_ASSERT_NOT_NULL(test, priv); @@ -1685,7 +1685,7 @@ static void drm_test_check_format_value(struct kunit = *test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), @@ -1707,7 +1707,7 @@ static void drm_test_check_tmds_char_value(struct kun= it *test) struct drm_connector_state *conn_state; struct drm_connector *conn; =20 - priv =3D drm_atomic_helper_connector_hdmi_init(test, + priv =3D drm_kunit_helper_connector_hdmi_init(test, BIT(HDMI_COLORSPACE_RGB) | BIT(HDMI_COLORSPACE_YUV422) | BIT(HDMI_COLORSPACE_YUV444), --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.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 F32811C8FD3 for ; Fri, 22 Nov 2024 09:13:18 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266801; cv=none; b=q4D8G+J17uErx/sDVvZRXtXiiTx+Ne438FXl5RL07/qSuxu2zd6Esx64j6dTrB54W0TPpTsGzVJzF9z1q6PKM0O8l6zJfvx2DmBUPSG/YBmPI58mjOnUYlptMAAhuTjxiZVHcfTchGFu74v1351VX2n8tmJaI0mF99xyQjReGD0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266801; c=relaxed/simple; bh=ua4QBZ4riM6Opp9fYNSoyg41GZXfyIYINU+ndYQUB6k=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uy3a1zFGXf5ty4r3f5nNooE+XK1UBGafiJxavD2TM/ScoWBaQuZd5Mh7r4MIkbW50BNCRPYr0HZI+u5TzCJJmWcGwBP7a1VBMKaDTZWL5K4pXaX8+tZTFPUKFHwDoOHZpOsfNnhRddnoTlKZ5MZXlEp38NeJUo9IZR3fODjFIU8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=jEXdmPj3; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="jEXdmPj3" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53a007743e7so2078331e87.1 for ; Fri, 22 Nov 2024 01:13:18 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266797; x=1732871597; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bn7n+Ij/Vq2ciN8r7fMFmAZOh0BG4t/fByh+MoATRM4=; b=jEXdmPj3IXRBD3JOz4JGiHh7SehpwC9xhSQg/8lW0S4tjr0qVbflCiFLfesS3TwBzM C1XTqHGPvTleIpFNOmen30jX6H89wUgT3DoF7fCZ0aOM8Uv+DpdE4O5UQDm+dnjPPND+ VKmbXRfkAohQgK5SrPy+OMEV8rXyVWZYC7wmj/Fr20ETt57ZbEQR/Q6h4zVsNVIx+edE v3Gxxgyn6QK13PriQTpJtuYI8FXyj/R2pMWQJykemkFVFY+V+vkfw9/bicF3xH3zxD3w RZb1KVrz8JB0P6EAB45rjW0NGFsGKAzxpF/85CxC0hXVgP9OwgzVtHiVdgAxyR0MKaXl AoYA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266797; x=1732871597; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bn7n+Ij/Vq2ciN8r7fMFmAZOh0BG4t/fByh+MoATRM4=; b=gaRfNz0hkWFvozlxyIbLtidZYF8OkEBCCsdNTdcOGYVqIcmyd325YvpefMEkFRkMG1 edzqvl66M5aJ1QY+OZoUuZ29Z2/VEkr35lmgO9dZDUjHlgXt7GhtvJf241ohwrXbv+47 MXZrJzoeeTV2sIawh6h7ZXs9dY7wZErItz7xoYFLrIWhZxXvswpyh2UV/2WWWrtTztQd LgptSsOftfvYDMDyhMAVjYFnfYMBp3ngvHb27sDhibUu3kocWOYD8oD30xzFxHUxteAZ YaztQP2q4B+ljbKh+eh4W9hlVrlQbz7OCdBl2kptwQr4K1n+q70++No7j4DLyRw7Iy9A WH2g== X-Forwarded-Encrypted: i=1; AJvYcCVXJ9dXd52DwVIzLNdLfWCufUW42dfe17MCfxkylJ3emPBPUI+0WvuEdf5GzihJtst/Mggk4bBKsfJTcTA=@vger.kernel.org X-Gm-Message-State: AOJu0YxFbwOlB2eL+wP3iAGIfy1pe8QcXaS1J+3WViLaBaRGNdI981ed gm1L+RjjtBFQTNiUfWm5HfGdvUK48eaH/YWRv/5mA45WzXETbjsO0WiTwsQ88VLtcWDpmuncBL2 D X-Gm-Gg: ASbGncupQaoPkbeIwxpHyMjnojBL6Gmr3DiNw6dX+8qKcI3qvC5oqYcdYWD4n+ezAni VvJYVyeqZz+O3wDa9tVw6HWTHe3tkAGI7K+0y34fQHGELOTVHtM2S0kBGOM13EMXjlfxvyl0bJM IwoB+NM2N9DfA8GO73nVlbAgXvwMs4GtsDVl+3w3KmuFiOH5izGWLFTN/+gmQHnXvl1OjZLexHY U7JRefVmGuxd0tEOq+1EHYjPV8xCL4A2eNEI3JtLAX/1aoG/ikExr0uJw== X-Google-Smtp-Source: AGHT+IFq3zbQ0De3BTK0sXYYbItGqTSGZgyN0ksGm0iVTU9b2Y4WWbgSyJUSMBI6BlqGlAARhL7baw== X-Received: by 2002:a05:6512:3c83:b0:539:f7ab:e161 with SMTP id 2adb3069b0e04-53dd39a4c72mr747793e87.45.1732266796855; Fri, 22 Nov 2024 01:13:16 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:15 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:12:59 +0200 Subject: [PATCH v4 03/10] drm/tests: hdmi: return meaningful value from set_connector_edid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-3-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=6697; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ua4QBZ4riM6Opp9fYNSoyg41GZXfyIYINU+ndYQUB6k=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshxoQTVi+os/StFFK828rJmRTkBm3HXf3HO zvtKRVX30SJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1dt8CACsBNzvug3dVlllsHPsfMwgWOnSIMgZwk0MWkGA0gAUUoTWpzd8byhb5O2YUsxEjhr8Pkc rf4sGlX9xHatXY1VjWmQallOgJ47yMezHGxAXqU2PIBMvbWSRERsZLvhhV88v00dmoXIvnRK1Ft aJl73es6aUazP/Y54Ew7mQ67iwgmpbwBjLtXuP3QjxU34fWTp0ca1GTepxqcEtGyG/w24eNDcqW K3Wm9uQY70CNwQUwLIPOI50MQCd0FBUrZ2vx6S0JW3yvojemLbXB4Hz4Yhk+OscNHFE0URzxFq3 UmTvOfjhJp4j5t73KK4l+jKMfEuWyAuHtsPfjDgiEftV8Snk X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The set_connector_edid() function returns a bogus 0, performing the check on the connector->funcs->fill_modes() result internally. Make the function pass the fill_modes()'s return value to the caller and move corresponding checks to the caller site. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 31 +++++++++++-------= ---- 1 file changed, 15 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index d81254d46975e8af0d782249928217a1ebb7646e..c963d7015d179ac36e646d4c19d= 986ac5997dd2c 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -105,9 +105,8 @@ static int set_connector_edid(struct kunit *test, struc= t drm_connector *connecto mutex_lock(&drm->mode_config.mutex); ret =3D connector->funcs->fill_modes(connector, 4096, 4096); mutex_unlock(&drm->mode_config.mutex); - KUNIT_ASSERT_GT(test, ret, 0); =20 - return 0; + return ret; } =20 static const struct drm_connector_hdmi_funcs dummy_connector_hdmi_funcs = =3D { @@ -223,7 +222,7 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test, ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 return priv; } @@ -728,7 +727,7 @@ static void drm_test_check_output_bpc_crtc_mode_changed= (struct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -802,7 +801,7 @@ static void drm_test_check_output_bpc_crtc_mode_not_cha= nged(struct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -873,7 +872,7 @@ static void drm_test_check_output_bpc_dvi(struct kunit = *test) ret =3D set_connector_edid(test, conn, test_edid_dvi_1080p, ARRAY_SIZE(test_edid_dvi_1080p)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_FALSE(test, info->is_hdmi); @@ -920,7 +919,7 @@ static void drm_test_check_tmds_char_rate_rgb_8bpc(stru= ct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -967,7 +966,7 @@ static void drm_test_check_tmds_char_rate_rgb_10bpc(str= uct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -1014,7 +1013,7 @@ static void drm_test_check_tmds_char_rate_rgb_12bpc(s= truct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 ctx =3D drm_kunit_helper_acquire_ctx_alloc(test); KUNIT_ASSERT_NOT_ERR_OR_NULL(test, ctx); @@ -1121,7 +1120,7 @@ static void drm_test_check_max_tmds_rate_bpc_fallback= (struct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1190,7 +1189,7 @@ static void drm_test_check_max_tmds_rate_format_fallb= ack(struct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1254,7 +1253,7 @@ static void drm_test_check_output_bpc_format_vic_1(st= ruct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1314,7 +1313,7 @@ static void drm_test_check_output_bpc_format_driver_r= gb_only(struct kunit *test) ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1381,7 +1380,7 @@ static void drm_test_check_output_bpc_format_display_= rgb_only(struct kunit *test ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1447,7 +1446,7 @@ static void drm_test_check_output_bpc_format_driver_8= bpc_only(struct kunit *test ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_yuv_dc_max_340mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); @@ -1507,7 +1506,7 @@ static void drm_test_check_output_bpc_format_display_= 8bpc_only(struct kunit *tes ret =3D set_connector_edid(test, conn, test_edid_hdmi_1080p_rgb_max_340mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_340mhz)); - KUNIT_ASSERT_EQ(test, ret, 0); + KUNIT_ASSERT_GT(test, ret, 0); =20 info =3D &conn->display_info; KUNIT_ASSERT_TRUE(test, info->is_hdmi); --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.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 0515A1DE2CF for ; Fri, 22 Nov 2024 09:13:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266805; cv=none; b=pnF2eUFUA0B+pe6u1zRc7zamxXVLlqVYouZiKWeN25S1dcDfqC7qFOJ9rp/hr7tHMUUfB6OnUHYzCTcqJy1W9okTrDQraQBIR2a/gCShOFndQO6vfNHrsH3f64Jd4/JpdIPFVyUxU5H+Fck/q+/ssGDv0l9BQNIyspPAYB+xRj4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266805; c=relaxed/simple; bh=wY/uC1PCjWkJKUNfZE4ZBtsvQAOLFrgM9xerITmFDM8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=uI53Kttsry5lMF9HnEbv95JoQGz5dNP1Cd3bHKzxRfgMrvzCgI6EE/ya6KTG98PhNc33m9UcD7JEaSXGs544ix/B1LFM9UQfrIkq5s29udehMg7/fN645YY+0bANmwJKHKWwZiqaubbw5W6jL05EWjB/IM9PZDyBUsMITxdVfxg= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Jv+nKH45; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Jv+nKH45" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-53dd9246d21so113689e87.1 for ; Fri, 22 Nov 2024 01:13:21 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266800; x=1732871600; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=ba/EAyhOmKbKPph2Ceo3mw6J0gYPpHFQfAWqlPPaiow=; b=Jv+nKH45VnoqEU0UfM0fizkDdOkuVytF8C72690N5sC1Z/ejHNQjEZCslWM9tuycaK uETMyn2sQWrB9hc2ax/zzlblJxPUzVOvxwT6qo7yqXDFsZgTDXCUdOXRng7w07sbeKrf 8tdwIQ8t0s61Q5tE2UREqdFMnipYP2cOozD9xrPIha1I22QFcMRoBuDprC7cAlo6tV+V BaGKtWIpDbH8yzx7o/lY18D7Uy7kBW/sDLsqx9zcVTZXyoktRRoty4g3V1aiKJKDAnWi edje8tqFSG1kqHcDFa1T9ZUWshC9eQT3J2IrU7SEE45cCXLZ3KlGUxQMPTL5ceXN/Fpo YECQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266800; x=1732871600; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=ba/EAyhOmKbKPph2Ceo3mw6J0gYPpHFQfAWqlPPaiow=; b=ckoPG4psMARqWV7Gt5a7Qme0aPIwAga/LitPq54uO59uRTIRDSjUGRQTOBY3LOYFFJ /f8QmoPZaQaaUQW1MXt+g9c9kLiYGtVmgLv19ftvcQ3Kvf/l3Wr3m3Ns1RRM8f4qDypQ 7MZ96zvcNmyaVkZAhWsXJvKa8s0hcNX32ykX9MTMgxbYBY8/nwbXapm91eZmdCFVlWpM RnqvDIJTd0PiCgnsqzEI7qcYwwJCEjXnTo4/m7rh3cggmj5r9JUQkzCE+x6jnsNdXZ6Y UeK+WdGVBMRnrohJEdBC87wpMuV/UQ8/R4rcbKfsOr0yrllGIEsmpjrtZ6ttUs5a/YzB 9RVA== X-Forwarded-Encrypted: i=1; AJvYcCUpGUzu06/HO4uY5LdnafMS20qqcc68ImOtUvSSKtGlFmzZUWzA9XaA6SvHG+mWZU0H9ba+CNJdOpSWiz8=@vger.kernel.org X-Gm-Message-State: AOJu0YxnfHamq+NFDp0aiKv8ABdzEVE6q7VRWGqbuMbs82T28SkXGJ5b gvmR4Uyjgk91YYWkBg8uXN7onBSc0p3kT0GaQ18osY/MI41pdj8TCvmoNoDKpyiKjQLkiVWzM7O k X-Gm-Gg: ASbGncvwM/KrhTvHlT3Mny7lssFpNlO3TTiAKS8qYgJ/jtXsi2l9+RTuNiPOAhHZhrq aVdYk4jWRCAYxQjCr9YPZ3plotlN6grWVskfIQRFfafst3wtoEQGNDh7k0ZIa1qsqYrYOvBIb9k UYowrvH5uIb2W6EURjaHuZkrbZ77rWo+U+jSnNYGiVQWdFNlax2blq7kGCVeFZXV6gN5vfPvL4F X/idgYFeaPLYjSTytj6/vK5+/3EdtJEeQV9qLf15iauku1e4UzDTBzgAQ== X-Google-Smtp-Source: AGHT+IEloGpSCZkAY9fYECNN7AmL5l8/ucTWWKZPqz8Es6PLt1G3lHbgplNDNueyAZtBmXwvXqVR9w== X-Received: by 2002:a05:6512:32c9:b0:536:53a9:96d5 with SMTP id 2adb3069b0e04-53dd35a89eemr1007347e87.17.1732266799401; Fri, 22 Nov 2024 01:13:19 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:18 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:00 +0200 Subject: [PATCH v4 04/10] drm/display: hdmi: add generic mode_valid helper Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-4-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=15863; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=wY/uC1PCjWkJKUNfZE4ZBtsvQAOLFrgM9xerITmFDM8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshbK5SH3bnK4fDYr0vrCrXPOL+uk2iCX+wu YtHiZpU68iJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1Qa1CACaX/ne04qVJaJeop0Bkt5TjH7NRAEMDr66EmnXfWTIyQdyImdkXXd2xHDSY3PDCSU/y+4 FQrDKHTqO2bO9Rk5utuT7bcTb8x4Wd0LINyfOjhWGRCfn/VmMfvjJad9X14MnUtU9pqDas+ETpI Ymk/JF5msBfoGEEOZRNdBs99Q4/ue5RgzfRnNCVbRWKCUgU3MXd9j04thRGSpJRTxBtgLjo4Uiy /kC46wir2UB5Ui6P9Te/JautpvSreWPTLU1RW5De//miBp+kHs5XBjuVda2YjdiMYBBql+f0aLn 7IEMc65Hk5QQIODo3nDEwMzWlGhuy0C+fyf/lpIBj6pU4Ef4 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Add drm_hdmi_connector_mode_valid(), generic helper for HDMI connectors. It can be either used directly or as a part of the .mode_valid callback. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_hdmi_state_helper.c | 21 +++ drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c | 180 +++++++++++++++++= +++- drivers/gpu/drm/tests/drm_kunit_edid.h | 102 ++++++++++++ include/drm/display/drm_hdmi_state_helper.h | 4 + 4 files changed, 302 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/display/drm_hdmi_state_helper.c b/drivers/gpu/= drm/display/drm_hdmi_state_helper.c index feb7a3a759811aed70c679be8704072093e2a79b..80bf2829ba89b5f84fed4fa9eb1= d6302e10a4f9e 100644 --- a/drivers/gpu/drm/display/drm_hdmi_state_helper.c +++ b/drivers/gpu/drm/display/drm_hdmi_state_helper.c @@ -521,6 +521,27 @@ int drm_atomic_helper_connector_hdmi_check(struct drm_= connector *connector, } EXPORT_SYMBOL(drm_atomic_helper_connector_hdmi_check); =20 +/** + * drm_hdmi_connector_mode_valid() - Check if mode is valid for HDMI conne= ctor + * @connector: DRM connector to validate the mode + * @mode: Display mode to validate + * + * Generic .mode_valid implementation for HDMI connectors. + */ +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + unsigned long long clock; + + clock =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); + if (!clock) + return MODE_ERROR; + + return hdmi_clock_valid(connector, mode, clock); +} +EXPORT_SYMBOL(drm_hdmi_connector_mode_valid); + static int clear_device_infoframe(struct drm_connector *connector, enum hdmi_infoframe_type type) { diff --git a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c b/drivers/g= pu/drm/tests/drm_hdmi_state_helper_test.c index c963d7015d179ac36e646d4c19d986ac5997dd2c..519cfbf1a3d6e82effb2372aeb2= 772a292230b5d 100644 --- a/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c +++ b/drivers/gpu/drm/tests/drm_hdmi_state_helper_test.c @@ -124,6 +124,18 @@ static const struct drm_connector_hdmi_funcs reject_co= nnector_hdmi_funcs =3D { .tmds_char_rate_valid =3D reject_connector_tmds_char_rate_valid, }; =20 +static enum drm_mode_status +reject_100MHz_connector_tmds_char_rate_valid(const struct drm_connector *c= onnector, + const struct drm_display_mode *mode, + unsigned long long tmds_rate) +{ + return (tmds_rate > 100ULL * 1000 * 1000) ? MODE_BAD : MODE_OK; +} + +static const struct drm_connector_hdmi_funcs reject_100_MHz_connector_hdmi= _funcs =3D { + .tmds_char_rate_valid =3D reject_100MHz_connector_tmds_char_rate_valid, +}; + static int dummy_connector_get_modes(struct drm_connector *connector) { struct drm_atomic_helper_connector_hdmi_priv *priv =3D @@ -146,6 +158,7 @@ static int dummy_connector_get_modes(struct drm_connect= or *connector) static const struct drm_connector_helper_funcs dummy_connector_helper_func= s =3D { .atomic_check =3D drm_atomic_helper_connector_hdmi_check, .get_modes =3D dummy_connector_get_modes, + .mode_valid =3D drm_hdmi_connector_mode_valid, }; =20 static void dummy_hdmi_connector_reset(struct drm_connector *connector) @@ -163,9 +176,10 @@ static const struct drm_connector_funcs dummy_connecto= r_funcs =3D { =20 static struct drm_atomic_helper_connector_hdmi_priv * -drm_kunit_helper_connector_hdmi_init(struct kunit *test, - unsigned int formats, - unsigned int max_bpc) +drm_kunit_helper_connector_hdmi_init_funcs(struct kunit *test, + unsigned int formats, + unsigned int max_bpc, + const struct drm_connector_hdmi_funcs *hdmi_funcs) { struct drm_atomic_helper_connector_hdmi_priv *priv; struct drm_connector *conn; @@ -207,7 +221,7 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *test, ret =3D drmm_connector_hdmi_init(drm, conn, "Vendor", "Product", &dummy_connector_funcs, - &dummy_connector_hdmi_funcs, + hdmi_funcs, DRM_MODE_CONNECTOR_HDMIA, NULL, formats, @@ -219,7 +233,24 @@ drm_kunit_helper_connector_hdmi_init(struct kunit *tes= t, =20 drm_mode_config_reset(drm); =20 - ret =3D set_connector_edid(test, conn, + return priv; +} + +static +struct drm_atomic_helper_connector_hdmi_priv * +drm_kunit_helper_connector_hdmi_init(struct kunit *test, + unsigned int formats, + unsigned int max_bpc) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, + formats, max_bpc, + &dummy_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_ERR_OR_NULL(test, priv); + + ret =3D set_connector_edid(test, &priv->connector, test_edid_hdmi_1080p_rgb_max_200mhz, ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); KUNIT_ASSERT_GT(test, ret, 0); @@ -1733,9 +1764,148 @@ static struct kunit_suite drm_atomic_helper_connect= or_hdmi_reset_test_suite =3D { .test_cases =3D drm_atomic_helper_connector_hdmi_reset_tests, }; =20 +/* + * Test that the default behaviour for drm_hdmi_connector_mode_valid() is = not + * to reject any modes. Pass a correct EDID and verify that preferred mode + * matches the expectations (1080p). + */ +static void drm_test_check_mode_valid(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + + priv =3D drm_kunit_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 1920); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 1080); + KUNIT_EXPECT_EQ(test, preferred->clock, 148500); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will reject modes dependi= ng on + * the .tmds_char_rate_valid() behaviour. + * Pass a correct EDID and verify that high-rate modes are filtered. + */ +static void drm_test_check_mode_valid_reject_rate(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_100_MHz_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + ret =3D set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_200mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); + KUNIT_ASSERT_GT(test, ret, 0); + + /* + * Unlike the drm_test_check_mode_valid() here 1080p is rejected, but + * 480p is allowed. + */ + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will not mark any modes as + * valid if .tmds_char_rate_valid() rejects all of them. Pass a correct ED= ID + * and verify that there is no preferred mode and no modes were set for the + * connector. + */ +static void drm_test_check_mode_valid_reject(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init_funcs(test, + BIT(HDMI_COLORSPACE_RGB), + 8, + &reject_connector_hdmi_funcs); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + /* should reject all modes */ + ret =3D set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_200mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_200mhz)); + KUNIT_ASSERT_EQ(test, ret, 0); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NULL(test, preferred); +} + +/* + * Test that the drm_hdmi_connector_mode_valid() will reject modes that do= n't + * pass the info.max_tmds_clock filter. Pass crafted EDID and verify that + * high-rate modes are filtered. + */ +static void drm_test_check_mode_valid_reject_max_clock(struct kunit *test) +{ + struct drm_atomic_helper_connector_hdmi_priv *priv; + struct drm_connector *conn; + struct drm_display_mode *preferred; + int ret; + + priv =3D drm_kunit_helper_connector_hdmi_init(test, + BIT(HDMI_COLORSPACE_RGB), + 8); + KUNIT_ASSERT_NOT_NULL(test, priv); + + conn =3D &priv->connector; + + ret =3D set_connector_edid(test, conn, + test_edid_hdmi_1080p_rgb_max_100mhz, + ARRAY_SIZE(test_edid_hdmi_1080p_rgb_max_100mhz)); + KUNIT_ASSERT_GT(test, ret, 0); + + KUNIT_ASSERT_EQ(test, conn->display_info.max_tmds_clock, 100 * 1000); + + preferred =3D find_preferred_mode(conn); + KUNIT_ASSERT_NOT_NULL(test, preferred); + KUNIT_EXPECT_EQ(test, preferred->hdisplay, 640); + KUNIT_EXPECT_EQ(test, preferred->vdisplay, 480); + KUNIT_EXPECT_EQ(test, preferred->clock, 25200); +} + +static struct kunit_case drm_atomic_helper_connector_hdmi_mode_valid_tests= [] =3D { + KUNIT_CASE(drm_test_check_mode_valid), + KUNIT_CASE(drm_test_check_mode_valid_reject), + KUNIT_CASE(drm_test_check_mode_valid_reject_rate), + KUNIT_CASE(drm_test_check_mode_valid_reject_max_clock), + { } +}; + +static struct kunit_suite drm_atomic_helper_connector_hdmi_mode_valid_test= _suite =3D { + .name =3D "drm_atomic_helper_connector_hdmi_mode_valid", + .test_cases =3D drm_atomic_helper_connector_hdmi_mode_valid_tests, +}; + kunit_test_suites( &drm_atomic_helper_connector_hdmi_check_test_suite, &drm_atomic_helper_connector_hdmi_reset_test_suite, + &drm_atomic_helper_connector_hdmi_mode_valid_test_suite, ); =20 MODULE_AUTHOR("Maxime Ripard "); diff --git a/drivers/gpu/drm/tests/drm_kunit_edid.h b/drivers/gpu/drm/tests= /drm_kunit_edid.h index 107559900e977119d451b00a647f0bd6ab598f63..6358397a5d7ab0bcdea1c824fc9= fd382560f4b0e 100644 --- a/drivers/gpu/drm/tests/drm_kunit_edid.h +++ b/drivers/gpu/drm/tests/drm_kunit_edid.h @@ -61,6 +61,108 @@ static const unsigned char test_edid_dvi_1080p[] =3D { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0xab }; =20 +/* + * edid-decode (hex): + * + * 00 ff ff ff ff ff ff 00 31 d8 2a 00 00 00 00 00 + * 00 21 01 03 81 a0 5a 78 02 00 00 00 00 00 00 00 + * 00 00 00 20 00 00 01 01 01 01 01 01 01 01 01 01 + * 01 01 01 01 01 01 02 3a 80 18 71 38 2d 40 58 2c + * 45 00 40 84 63 00 00 1e 00 00 00 fc 00 54 65 73 + * 74 20 45 44 49 44 0a 20 20 20 00 00 00 fd 00 32 + * 46 1e 46 0f 00 0a 20 20 20 20 20 20 00 00 00 10 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 01 92 + * + * 02 03 1b 81 e3 05 00 20 41 10 e2 00 4a 6d 03 0c + * 00 12 34 00 14 20 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 + * 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 e4 + * + * ---------------- + * + * Block 0, Base EDID: + * EDID Structure Version & Revision: 1.3 + * Vendor & Product Identification: + * Manufacturer: LNX + * Model: 42 + * Made in: 2023 + * Basic Display Parameters & Features: + * Digital display + * DFP 1.x compatible TMDS + * Maximum image size: 160 cm x 90 cm + * Gamma: 2.20 + * Monochrome or grayscale display + * First detailed timing is the preferred timing + * Color Characteristics: + * Red : 0.0000, 0.0000 + * Green: 0.0000, 0.0000 + * Blue : 0.0000, 0.0000 + * White: 0.0000, 0.0000 + * Established Timings I & II: + * DMT 0x04: 640x480 59.940476 Hz 4:3 31.469 kHz 25.175= 000 MHz + * Standard Timings: none + * Detailed Timing Descriptors: + * DTD 1: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.500000= MHz (1600 mm x 900 mm) + * Hfront 88 Hsync 44 Hback 148 Hpol P + * Vfront 4 Vsync 5 Vback 36 Vpol P + * Display Product Name: 'Test EDID' + * Display Range Limits: + * Monitor ranges (GTF): 50-70 Hz V, 30-70 kHz H, max dotclock 150 M= Hz + * Dummy Descriptor: + * Extension blocks: 1 + * Checksum: 0x92 + * + * ---------------- + * + * Block 1, CTA-861 Extension Block: + * Revision: 3 + * Underscans IT Video Formats by default + * Native detailed modes: 1 + * Colorimetry Data Block: + * sRGB + * Video Data Block: + * VIC 16: 1920x1080 60.000000 Hz 16:9 67.500 kHz 148.5000= 00 MHz + * Video Capability Data Block: + * YCbCr quantization: No Data + * RGB quantization: Selectable (via AVI Q) + * PT scan behavior: No Data + * IT scan behavior: Always Underscanned + * CE scan behavior: Always Underscanned + * Vendor-Specific Data Block (HDMI), OUI 00-0C-03: + * Source physical address: 1.2.3.4 + * Maximum TMDS clock: 100 MHz + * Extended HDMI video details: + * Checksum: 0xe4 Unused space in Extension Block: 100 bytes + */ +static const unsigned char test_edid_hdmi_1080p_rgb_max_100mhz[] =3D { + 0x00, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x00, 0x31, 0xd8, 0x2a, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x21, 0x01, 0x03, 0x81, 0xa0, 0x5a, 0x78, + 0x02, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x20, + 0x00, 0x00, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, + 0x01, 0x01, 0x01, 0x01, 0x01, 0x01, 0x02, 0x3a, 0x80, 0x18, 0x71, 0x38, + 0x2d, 0x40, 0x58, 0x2c, 0x45, 0x00, 0x40, 0x84, 0x63, 0x00, 0x00, 0x1e, + 0x00, 0x00, 0x00, 0xfc, 0x00, 0x54, 0x65, 0x73, 0x74, 0x20, 0x45, 0x44, + 0x49, 0x44, 0x0a, 0x20, 0x20, 0x20, 0x00, 0x00, 0x00, 0xfd, 0x00, 0x32, + 0x46, 0x00, 0x00, 0xc4, 0x00, 0x0a, 0x20, 0x20, 0x20, 0x20, 0x20, 0x20, + 0x00, 0x00, 0x00, 0x10, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x01, 0x41, 0x02, 0x03, 0x1b, 0x81, + 0xe3, 0x05, 0x00, 0x20, 0x41, 0x10, 0xe2, 0x00, 0x4a, 0x6d, 0x03, 0x0c, + 0x00, 0x12, 0x34, 0x00, 0x14, 0x20, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, + 0x00, 0x00, 0x00, 0xe4 +}; + /* * edid-decode (hex): * diff --git a/include/drm/display/drm_hdmi_state_helper.h b/include/drm/disp= lay/drm_hdmi_state_helper.h index 2d45fcfa461985065a5e5ad67eddc0b1c556d526..d6d65da6d8f9ee46de33114cce2= d6fbe6098a862 100644 --- a/include/drm/display/drm_hdmi_state_helper.h +++ b/include/drm/display/drm_hdmi_state_helper.h @@ -20,4 +20,8 @@ int drm_atomic_helper_connector_hdmi_clear_audio_infofram= e(struct drm_connector int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connecto= r *connector, struct drm_atomic_state *state); =20 +enum drm_mode_status +drm_hdmi_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode); + #endif // DRM_HDMI_STATE_HELPER_H_ --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.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 43C2A1DE2BE for ; Fri, 22 Nov 2024 09:13:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266806; cv=none; b=LjzY3XHmiZ22lgThhXsv7sV78MFifL8NCOxMJE6Zd2mHxwhoNaEq3d2vRPPy7DnFIewXVEDI86Ij5h0ET+I0ZSe4DMEJWUwmeFj9T58OW1VhgIe/R6WyIm2l1VryXsScd6jgvB6IoXXWGUtJfBdV6vxGN32UruUkaNsWuOW5Pyg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266806; c=relaxed/simple; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pD16vQTueI7bhmRb5q3N6fRaSPime1nbOusPvE6/3ABDPgCCCumbsT3OmVJkmPrrbPKBJD5JFIQHpfiCT97JUzv4IQlVIdsxr0c2y7ISjCi8tUcYMdTeZ3xqmZ7+9NTE7wBZF+5vVTUDdwzUM94mAjKzEhg1nU4GYQHSEOTgVJs= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=Z1vEwtbm; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Z1vEwtbm" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-539f6e1f756so2050846e87.0 for ; Fri, 22 Nov 2024 01:13:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266802; x=1732871602; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=Z1vEwtbmmyO4/8F0W598beXFxaLScGHwPW15cV7iQTGOB2NZMxelL5d1dqbG6sdu1j 0tmzzPNx7RfxMsAVkIynn10b8n9cKUVhs7/stYQcIrCiwRpX4hiteENO9qBdq+X9bbD2 xyQLFzmy0dmkt7mWado5KKXaGUOYWAUn8J7PyR1fg97RwoWA422dIKNlNuiocos3KTQ3 mStvOjXb1vM+zLOMp40wZyrTIo1NslCcNSoGn+0tim0dblCLy8S84Ya8AmzVqj0gIU2c 2T+GkJh0gDud72cXtsiR9wLFg69N9m+FLLSlapI1VPsIVnHO+H5qJ/2CmGmVt8dKTk4u 8FFg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266802; x=1732871602; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=YdWiUnW6vTgN40+31xk3R74ZtFvE1HPhsssihDLePE8=; b=BiUcA/REU5dQDEP+zDep7ynjRtOqo5OyWMcwfYWw5cP1sNgejSFGW8gY9q45PoB/rF XH4EtvkQPeYVBAETKML66T5ncXi86GprDGvVHsjmrVq2bM7fnJNiVet7e2dhEQLMALw4 UryPNHEpHzwEvNWY6oZgDsWCBKn1cB66S+gx0iG8EKStp4fV0OJu7xQ0eqJVaC+hKrQw mjorYPXv84kYw2KZLP4P5lTi7yn5BFI6GJoAQ9sZxRbXCd6XD+HUdxgr4YqseWKU8wtc 9u+ESCcWeL6Kh0jgGs3PoYBjvI3VurfIlOXkjlrX6QQXaX6LO3M2BoQUU9xQu8U7lr2B 8koA== X-Forwarded-Encrypted: i=1; AJvYcCWQR0Kw4BFjlReqNQS435LMoyXoozlFqGwCF3rNI0ZkElW0jXodQ5GvtJb/ZDGPDpZlSGz8PIGO6Vh4I/Y=@vger.kernel.org X-Gm-Message-State: AOJu0Yz9hqgQqYvCN+g8Wa/w3XuKB1wnU7DHxZX7YxWT4OMsJcjwZ/ZF 9YQf+1LKYamJ6O84dC4d+Wsp+cRLYm1gcg94bTR/mcVSuTR5Kx3fe/ODXUl8z+ibrZJ8KVW6Gf5 y X-Gm-Gg: ASbGncv84UypRrfFEXaCb4A4RrLhu2FxPhLQoQawXMy+QP/BOaPVIqBijbuTiiqV9vy zvrkRbsIZ3runoUH5K1+HkpAH9MT3dNx1cVDtfMW5H3yOfMV2BXWEG5fNhwe5hbJ35Cx+aKpapj oHBOa9EfobDKYNmkQ75cCFjaFWM+De8IFoT2+YOSSXAxo0wHE2gS9kie5q9LkYxa2Zqet83GNXK uFOLeLd/gaXc2xGwJY1G3ghNlu/gs0Vn2mjGtGaacuMhT+2FaGK1ofv3Q== X-Google-Smtp-Source: AGHT+IGGtUj/UQVAqhj71L/+WsqH4TByvBEbJYS9Kr4E80g55FT15j0av7rsnKtHopezihZc5TlJsg== X-Received: by 2002:a05:6512:114f:b0:53d:d5be:4bda with SMTP id 2adb3069b0e04-53dd5be4be0mr678315e87.17.1732266802045; Fri, 22 Nov 2024 01:13:22 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:20 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:01 +0200 Subject: [PATCH v4 05/10] drm/sun4i: use drm_hdmi_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-5-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1574; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=7WdeDK9PVMnPHS0xN6wrfKPJv4ESCzGwmvZnGPcMZ/4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEshvg15KlERBUKq4lR2p/TSqtj5mXXjddQL8 zndDKhDnu6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIQAKCRCLPIo+Aiko 1UswB/oDlMjmP0dYXrp0SYxKvIUkgl6MY851PyW708IlMOZOJbH5lo0GCNkGsMmCV16kq0l1ais KIus1wfQ1xA0lwo8KtUJJeX6gPpLRN0nWs5AbJm2S53M1m+XwFjW11vOEZYe5BEyvuq6cTNrqOf SP5rwIdTIFJYNqC/T/oVX3emjSYFRHp0mS6piDuxv9io3UFM5M9xGCDSP9ZsYwVCe0uwtI7lOx4 VwYEaqqRz+m3DbfRHe6M2eQAtAMGgLCsyo+Rom/69e0SKJkKkWncfEMwKQez9slaQ8GeIXaA4E9 KsJ/lbh1VelTpjfb+9nV77MboAKh3hm26Msd2x+zXcDXq7U0 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 12 +----------- 1 file changed, 1 insertion(+), 11 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i= /sun4i_hdmi_enc.c index b3649449de3026784ae2f3466906403a0b6e3b47..54b72fe220afacc208b3fd48d51= 60031127ea14a 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -205,16 +205,6 @@ static int sun4i_hdmi_connector_atomic_check(struct dr= m_connector *connector, return 0; } =20 -static enum drm_mode_status -sun4i_hdmi_connector_mode_valid(struct drm_connector *connector, - struct drm_display_mode *mode) -{ - unsigned long long rate =3D drm_hdmi_compute_mode_clock(mode, 8, - HDMI_COLORSPACE_RGB); - - return sun4i_hdmi_connector_clock_valid(connector, mode, rate); -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi =3D drm_connector_to_sun4i_hdmi(connector); @@ -269,7 +259,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi= _hdmi_connector_funcs =3D { =20 static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper= _funcs =3D { .atomic_check =3D sun4i_hdmi_connector_atomic_check, - .mode_valid =3D sun4i_hdmi_connector_mode_valid, + .mode_valid =3D drm_hdmi_connector_mode_valid, .get_modes =3D sun4i_hdmi_get_modes, }; =20 --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.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 9112C1DE3D4 for ; Fri, 22 Nov 2024 09:13:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266808; cv=none; b=QwxdiIdMdD8CxV6EZCwvHGpTZXsetnOE9Y+Jg7Rma1G2PEzdpw2Gfct8DXemjEd3jU0Ffc0x66T6puHOV1XctSyXLY9vQhooYdOl2siD5XWJQrausrZ31gZXmwyWd2NsTI5RcuOMDYkpNhHimVyFIYgOW6oOAKmYmYBXNNWpPds= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266808; c=relaxed/simple; bh=V4oVcdTHVT3mKFPFYYqaTi+sHqWjzKg7CIWwA7qtBbc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qfrs0pt8MmC9IMG6rAbbFhwTkZ0k1XO/AZ58Agpuue8asQyz4FjD0+madJpVrkt29Y/xNAYeLk2RuVXNzTI2kSHrkkgL2nMGPg4Z2HkwO3vBpQtP8dbhY96VhtlqmTQg6FOuI1DdqHiJ1ptFwb/WNIqHgP2yx43JFTnk1mB2zrI= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=JMwehT3u; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="JMwehT3u" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-53dd668c5easo215985e87.1 for ; Fri, 22 Nov 2024 01:13:26 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266804; x=1732871604; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+yuGfl/EBV1L9yZwllQ4z7rC0GCiUIVGF8V+6a/LgMU=; b=JMwehT3ubG6cBGrMchGLgszvSoDljUCg8Qzn3aQVXpjY+TF80uSs4g+D5vllkg9JTX 99h2kJO12tw3UPDq/ECQg51Ks6fRkrl2AmoiX2YBeDQ79ZI6ETnXGBTWEaL1ABHCNQt7 q9t2svHFHZ1l9Rp5JevjArkjIzO1GsMOaiNmPWZS3ELhc3eUKfLam/1tXupq4DNM1GJr RMc3/K5+vkhy7pCfnVbPuLesqGt6lrU7ZjFQGVqzRFLbLQN/p9k4sV6nc/IlJ+1awM5r JXD9AZcbir8Gt76bdovjtCvrZeR0p2SrmKpMdwOfQZCBqX/kJoMrcMwDIDlcMF7GpOY5 GSaA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266804; x=1732871604; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+yuGfl/EBV1L9yZwllQ4z7rC0GCiUIVGF8V+6a/LgMU=; b=cevMPT8T2t50sVltdEq6FjhpiM6vxP7OHfE1ZIEGYnzh5iNsK60nwBexV1CgcbZcvT YTKDz9ogpUJkkG/O4vie2181Ng1dSAjy/P+YmEEDsOWuBuaAhHBp7JabcNDoDxChgT8r 8n+EpXx6WJbx7xRo0sH3TdTmAKEut45olPsKKB23Vesm/Bzr6pcURZZE83uUKz+Q0aQy 0KXfY6DlwSmF/FAIpJRB0v7316pP7t2mPJKSeMIL28N1AcsrYEOM3UDoiGxug07YqF75 5jdbeTinhQirfw/v2vp34Uk4wGlTiReFR5s/p5OxA9qECdxO8PmuQVk0w7GDnw/xpPwF 7oUQ== X-Forwarded-Encrypted: i=1; AJvYcCUAyva76NGmZ8T6qhVhn2tuXrM0lHK07JUPpJJc1LAHopUHzgAGVdgDYF6nraQntvFKDETG/WjPFoTiMZ8=@vger.kernel.org X-Gm-Message-State: AOJu0YzB4XfCeiKYtoMo0oXWR9a/D0foqYLF21Kd1jzPsgu25+PGLahs 9DTT1jDE00GsNLZU66VOVYRmK5coDfYoXCvPy20RWbdAZmRtT/LtDDE5E7YAXkZwzqPfvo4bwpg C X-Gm-Gg: ASbGncvJfnRc8nXyTwR5cjzPHIBWirYTDZyeOf4jujTjE2rbABx497F3j6bOMHis+As Bb8fTuj8BX+eUFUA/qzfAwgAzCYEWVc93cOjrfGs49s5k6+ZPJkb9w1UvNau+YGApHHWHuhkaA3 S8aUGCNRr9tNJSbExypQ91ebGdqRxMFye90sOLxUafefsKidLgRA/5wON6PwQUn/pjvKHXbWMUp zPDOCHiFHLOOKjgQ5/bgf7ymmmuf+4hvhWQEvVnAGBZTE2l+AvPyPMpQg== X-Google-Smtp-Source: AGHT+IFLvHEAOMFsbgXw0Dwjm3ehikp3aJtpuOLNAA/Ny7NGqmxqJedFV/QSTgM4ejrUuhK9ANir2A== X-Received: by 2002:a05:6512:3c8a:b0:539:fd75:2b6c with SMTP id 2adb3069b0e04-53dc618307bmr1957531e87.21.1732266804495; Fri, 22 Nov 2024 01:13:24 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:23 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:02 +0200 Subject: [PATCH v4 06/10] drm/vc4: use drm_hdmi_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-6-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1740; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=V4oVcdTHVT3mKFPFYYqaTi+sHqWjzKg7CIWwA7qtBbc=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ7qDt5JRalysFtfhpV3XJx9r4HUI7Mk6MKsr+cPD+3Hfb Jbz8vN1MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAiGk84GPqERKMOmjLumLjD MnKKz41Pm3N+pJ9/n8z0rvuN6cMZVyc75WV+fMW/4fbSA2vvrrVpMe45G3ww+9aP3vVvnz98rSu 4O/isbPYRnyflj5ydRXks1ul3emxm9fvxfFpOelVarJm2RHEYa/6RS44puVXrtA+wmssZ5c0uzJ ygVmJ9LPPTud7Y0PcL77Sd/xHW+ob7VvMR38uiHV0XZA79iVnTJeCicc++kzU/JSzJ6oPkpn6nn mvqh9ltP5Y1VQhNcD2W0HDzreEji7nuNWpRnX37Lrr1bVsfapB0u+3tivnhToYGkh6Ov7Pn7ivy U2d2yzm0/xyn4Lp0CR2pL0vk/PYt+hT85/Dzhto1cnINAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_hdmi_connector_mode_valid() helper instead of a module-specific copy. Reviewed-by: Chen-Yu Tsai Acked-by: Dave Stevenson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/vc4/vc4_hdmi.c | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/vc4/vc4_hdmi.c b/drivers/gpu/drm/vc4/vc4_hdmi.c index 62b82b1eeb3694d1685969c49b2760cbbddc840e..2fecaac0df0acd865186ee928cf= 26449799fc7ba 100644 --- a/drivers/gpu/drm/vc4/vc4_hdmi.c +++ b/drivers/gpu/drm/vc4/vc4_hdmi.c @@ -580,6 +580,7 @@ static const struct drm_connector_helper_funcs vc4_hdmi= _connector_helper_funcs =3D .detect_ctx =3D vc4_hdmi_connector_detect_ctx, .get_modes =3D vc4_hdmi_connector_get_modes, .atomic_check =3D vc4_hdmi_connector_atomic_check, + .mode_valid =3D drm_hdmi_connector_mode_valid, }; =20 static const struct drm_connector_hdmi_funcs vc4_hdmi_hdmi_connector_funcs; @@ -1752,7 +1753,6 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encod= er, const struct drm_display_mode *mode) { struct vc4_hdmi *vc4_hdmi =3D encoder_to_vc4_hdmi(encoder); - unsigned long long rate; =20 if (vc4_hdmi->variant->unsupported_odd_h_timings && !(mode->flags & DRM_MODE_FLAG_DBLCLK) && @@ -1760,8 +1760,7 @@ vc4_hdmi_encoder_mode_valid(struct drm_encoder *encod= er, (mode->hsync_end % 2) || (mode->htotal % 2))) return MODE_H_ILLEGAL; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return vc4_hdmi_connector_clock_valid(&vc4_hdmi->connector, mode, rate); + return MODE_OK; } =20 static const struct drm_encoder_helper_funcs vc4_hdmi_encoder_helper_funcs= =3D { --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.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 25F7F1DE4EB for ; Fri, 22 Nov 2024 09:13:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266811; cv=none; b=PodxregtNA//dfB5qUz1gWbQegGOBJHCvhuaWhDCucG2nXKB5ZJScviRHXnZgzlQpsbkRKytsBDFSlFf3jBehc11oTPk142hjvTIDOGWocWfT40RCIqsvAMBNaY2XIBGJpWA+RghV4K8oHpDV56RSH3ks5pVOuwNOM/xEfrAXIo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266811; c=relaxed/simple; bh=V6uHu+T4+xW+xwMuVx/apScXj6PwN9KdCvTiBY/zzqA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=SAfwrgmdKN9+JSETfPAlf4o5IMZPYiBHSOkdWjPAMBhuJuzRFnhOde/9DtfPC56Wf++JiXhbqx5KWhvcYS0otytcPegFKa+K9bbYpZDbj/R1PMA84af1siZwa7zn0wDh68PAKnAN+8q+JHiUJBc980enljC4+vz+1cJExDdzy+A= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=al/GsPKL; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="al/GsPKL" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-53dd9246d21so113941e87.1 for ; Fri, 22 Nov 2024 01:13:28 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266807; x=1732871607; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=al/GsPKLLzMYIW7zkWlglZUBSRkJ5BNInDgg0LgCq6Lubl6BfwOHDrR4Y4zXlASobC 3SHVk5WhWqfsWpHHI8ao3hXr2AydUk9LnMEpceTdBoOks3XGYVaQ/wUOuVkXGZII9EZl tzHptbOwOLiDAyYBW/zVDHafSX/UIVcyDDokWE8t2yZUpc76WpMpvI/Ap6dA1pMMA3lb 4eqha1V5oUDtW55Da0m3OuAcIq6HRop52ytOtthzgUWYBGVfpyx5JftUq5yNFUDHXkvr jMLfkKWgTxZI+amGidwUnBp330umqOy/NF2pn9QK7NeujOm2p4qSUKFfONDrm3gEg+mC 5Sjw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266807; x=1732871607; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=bi+JDxO7zFRVUVNShSHXAVY8nfszGwV4/oGBGiyAqww=; b=B0Njx8KCEjZHxdchLoCg/KOVKLgI7QS5sF5XUkJA3oF55wseFKzQ56KA7GP6tHGotn qLv2zNrOzUe/IVnp7jpA+VnS7fmNf53bRWdhMkHhENlDtKmKzmRd9A/X3bRo83VdM51G af0p2fNauJN1iyCRq+mYumPCcw78NJiC/f0nmifeoDVBfJYzzlmIhjfJCKOF8osRjbS+ FVr0oaP5DbReU3h8ya/PDm85D1Fye+eQLSYDGMcASLNbvzHWphcEG4vL4S7co4xXgRxZ 1Ktxkn7F4R62P8HHXlcyxh6kzFkdcc+SfawFPB7rmxNSKRsiyqRc2sG0pqMnGTRE8XOW 8MXw== X-Forwarded-Encrypted: i=1; AJvYcCXt4rYL856LzJxSRInDtVeXLkaCr3JlRUw00S0if8a4ypXHoPCOepxUvXoICNTqpB3nuUW22VCKgRNdO6A=@vger.kernel.org X-Gm-Message-State: AOJu0YynWmBZQ2c+gnognbFqiS/jRYSJhisNp7FLLQ+Wf9XwhA5v6Ksx dG1qb7nr7CwVcU+NAPhjz/7yfVwCYvAzNuU1GsT02JJSXokJX+dVQ41SAkphIZ1TL60I+/JZEzI o X-Gm-Gg: ASbGncsFlp7ZffkImK0RQg1xUJqJ/AYHSFNQ+M8Ug6Q2AdItInVySzIK38y69wGNJZr LtS4czjj6Rtp7jRvE4X881/fsTq9jdn7ckrh4DQALtf+oTKJiJAzfJtLiiObEAdIQzo6jhmZyhB GVnZKABj6wINEUNrBoM7Vap039Q+Sgb+q2WiZA8Ulk3C+F3fVHoUP1UKSnlURmRYdPMc9HVk8Y1 nkOyrsWsNqdSR0S4UkU922a4X36KgAWnafNhB+NVKo8sbryw2DyZRkKMw== X-Google-Smtp-Source: AGHT+IGP0twniqH2U7ywDpdM5USOAfTTfwclZMuf64h3sSsbdQOKH5VgJsG4NoD2/EPGUBvock6QuA== X-Received: by 2002:a05:6512:3c96:b0:53d:a27a:2106 with SMTP id 2adb3069b0e04-53dd3ab0eebmr902104e87.55.1732266806968; Fri, 22 Nov 2024 01:13:26 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:25 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:03 +0200 Subject: [PATCH v4 07/10] drm/display: bridge_connector: use drm_bridge_connector_mode_valid() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-7-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1872; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=V6uHu+T4+xW+xwMuVx/apScXj6PwN9KdCvTiBY/zzqA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsipUZxr2L4H1CSYJPqrSWitJVJYT8cvGGNx VzJVBpVLQiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1Wg8CACUh+Qp1wI3QCkqrRc4xvtyhadjSchb8neePNvcL0EeS3MTH3BWZCvgSLpKslneK9k6yVL 9DTKhgzCmZL0UPCkBx9as8mvdKQBUN1m/r3gplfEUsQe2bFoVBzI24JWS3ZAVJbe0RlQe5A+N4X EOOFCw+LkSv89UJBKWSvUvCm4ez0JYCuuQEDWX2MivOuHLjIzOHKXnubiYcFK9u3+KsRADnp1mi RBNUHr/fnJw+uvGlqRKuh3Z3pa9ig+V2gAlc7T2X4/0rhodFgbNr3XmxnOOKnL3E4DJ7eP9ejOS 8KSZ5CU2TIorVoGQxGUAz2vtTDQ5bGJWekzxiEE6bqzE6v0O X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Use new drm_bridge_connector_mode_valid() helper if there is a HDMI bridge in the bridge chain. This removes the need to perform TMDS char rate check manually in the bridge driver. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/d= rm/display/drm_bridge_connector.c index 320c297008aaa8b6ef5b1f4c71928849b202e8ac..512ced87ea18c74e182a558a686= ddd83de891814 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -18,6 +18,7 @@ #include #include #include +#include #include =20 /** @@ -299,9 +300,22 @@ static int drm_bridge_connector_get_modes(struct drm_c= onnector *connector) return 0; } =20 +static enum drm_mode_status +drm_bridge_connector_mode_valid(struct drm_connector *connector, + struct drm_display_mode *mode) +{ + struct drm_bridge_connector *bridge_connector =3D + to_drm_bridge_connector(connector); + + if (bridge_connector->bridge_hdmi) + return drm_hdmi_connector_mode_valid(connector, mode); + + return MODE_OK; +} + static const struct drm_connector_helper_funcs drm_bridge_connector_helper= _funcs =3D { .get_modes =3D drm_bridge_connector_get_modes, - /* No need for .mode_valid(), the bridges are checked by the core. */ + .mode_valid =3D drm_bridge_connector_mode_valid, .enable_hpd =3D drm_bridge_connector_enable_hpd, .disable_hpd =3D drm_bridge_connector_disable_hpd, }; --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f44.google.com (mail-lf1-f44.google.com [209.85.167.44]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6B50F1DE896 for ; Fri, 22 Nov 2024 09:13:31 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.44 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266813; cv=none; b=GDU5FBmPkPaY/Snn/sksKEQRCRV4kYgt3U4PhtFrjVgDyyU4ihwqWXliEV/0cwYTZr1tN4NkTqju+9hW4j4m1kurGI3wJHuDp4QVL40ZPjy0ZeelgB00XclN8NRSPzF3vqZ928FxwCNLu1GdCf5SccWNmnDHrO5ZhzTNAHId0hk= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266813; c=relaxed/simple; bh=CHPPIcbOk/4oF+oFDkgVgA19LBW1SDNLoLgjIjG3wi4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VG2q+DQnyFq4rJEdw2KG2HbA//3L2yvb0M5/GULhBpTWqjndwh0MsJengP/t6c+k/cJx8LxaTwt3MFMftnXmrlqjfWM4notXleDvkbTNQrUPx/eT6QXAo90NJWd/yThBh3XbCRIXoNZ0h2IYhf2ZYJHJt5icSiTv2ESBUQZAeyk= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=boQTSLxW; arc=none smtp.client-ip=209.85.167.44 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="boQTSLxW" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-53da6801c6dso1628398e87.0 for ; Fri, 22 Nov 2024 01:13:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266809; x=1732871609; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=+hHECBYEofE1LVFfISufmiOFENr43Xg+pptUAkUKUyA=; b=boQTSLxWLpdTG3fJix388xicu1XtVuf0VnpJZ1slsHBZh8jWJKsqZCICmbsskKfM9O FHghq9c74iZS6mdypQY7UyEEb0FYE40AuWeNC/qbTD6WehgdbQ0/+S6ePypvNq1AyWwY ZO1k2lsGYlJElzBoLQwQw6yaGyh4MT4j+J4LYJZldr/1oCDEh2JroIObuY4rT/FW2zX0 3pE8ULj3FrDSp7kZsxTOLgOLhXqnxk78sRQbvKRbjMsDbap/+wDdxrsNiPpXMpRC6FpM oi8czz36NeSymQfQAmvjM+TmBoWhFWi9KntKxlo5axUa7c4EhH0ZFBHKQjuhI82+Kyep Zi+A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266809; x=1732871609; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=+hHECBYEofE1LVFfISufmiOFENr43Xg+pptUAkUKUyA=; b=qgPO3ief5qyxWZ8gM68Iw29W/lX8vSneNR5DIIrD8Q5uFa8yNbe1+r+/hID3En08uc eDdp85qE2vRgOsQtYs1kc/r67WAUQtaG0CpQSUqnGLiH+jlficuI5XhM7XffOGa4X9IN l/33wj8MsW2rXWCtGFeUe7CPrzKpJ19XH9jlau8R4et2k7gpOzqYCNCkdXQp8Ddw1Mmn X86fZDT203DCOblbQb9T++MCHnyk9//XSDL3RP4QV7dZhf6jee3udR+Rk/VqakC6pSSw K0jEJQ8Bg+tlYKHuqcaSRbkgZGwpWGLKJ+AUAv4pNge9Kgmho5LgOEZsIDEMD8GPoUWk JsKQ== X-Forwarded-Encrypted: i=1; AJvYcCVFGcfPp3Y2Ni+JotJIsl7ifiiT38UX3JyFPJ9BRWkmNHHjSFc24zaOzxRnBAEC7C36yGPycgAvQw8qQWk=@vger.kernel.org X-Gm-Message-State: AOJu0YzlptE0zZdTXZhFskend07wHASjxm4TAan7i4G0sN1/K6B+8nkZ Uaw53YdLJN+BzGwx373SWBw5fpwdDVlUzxE99ADhOH+MUx5Hx3DhtwAn3OEmizpUxm7A0jWBQwy B X-Gm-Gg: ASbGnctvT/BhPQps+SsYi+3TyX9gB8rk6xfKDvf6DM6hawa8OapJvbHJYuLcfdlW93v TMmEJXOObZy0l2TgCVofZyg+Rp6BKIsf+LjgYADM0UmSzytS8vEdr1ex8iLtaE87Xt76wbI7o+U f2DPWm3Ftg0rsdCy6rQHLsS6H2yE5NwnAlp08AM/nBM/cgS2k9qP6n/jPIZOTRZPg1m2lmk6tmQ k32nmE4faFTWiUg4EwxIzesrc8LSMwNG+PDMCwZf50eZvgCKird60bVKw== X-Google-Smtp-Source: AGHT+IEacF2R7IM1WOXDiiyEZw72yOQOODx70vgQAIsHBOvrbaiI7+vacg+XzA2nbeGhQv/5FVkoNw== X-Received: by 2002:a05:6512:33d1:b0:53d:d661:ada with SMTP id 2adb3069b0e04-53dd6610bdcmr495351e87.8.1732266809396; Fri, 22 Nov 2024 01:13:29 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:28 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:04 +0200 Subject: [PATCH v4 08/10] drm/bridge: lontium-lt9611: drop TMDS char rate check in mode_valid Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-8-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=1393; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=CHPPIcbOk/4oF+oFDkgVgA19LBW1SDNLoLgjIjG3wi4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsiedj1vWQXgZXcLJ02DcFxwDE5gszj18sAt X34dCGJZmKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1bSCB/9slyF05dGTP/R8bS3bpgFrC80+3aCli/HGX/hh9ZecB7M0/4Gtv1SuBYM+KdZhbrux6LE pczE2VQiA9zmyEtW0G5wbp1FeQvVBM8ruyAQIhmvjHQQTlnjC8Upiw/vuPynB4nUVZWHfhhYQmL zAEr0NKRnfHyVcsBRwxOdxyoVLnAqyl4aW9Ms616ITIiIb8MXaArqLlDxULPZrDRxxX17OEl0V6 PCmq7Qc1dmPgMoaJfFSHCVIrgBet7swGVQ7Bft4pgEsIeljuwq+YPquR/XJM8bitfAaIpRNn1BX frUWcluAbmUtixwbfjgPP6l9mfVYq5tjcrdl+FwRNElIvckp X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Drop manual check of the TMDS char rate in the mode_valid callback. This check is now being performed by the core. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/lontium-lt9611.c | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/drivers/gpu/drm/bridge/lontium-lt9611.c b/drivers/gpu/drm/brid= ge/lontium-lt9611.c index 8f25b338a8d8f95dc0691735ac6343675098f7f7..1ffbe473e4103dfc315a8cd3571= e9407bf518797 100644 --- a/drivers/gpu/drm/bridge/lontium-lt9611.c +++ b/drivers/gpu/drm/bridge/lontium-lt9611.c @@ -757,7 +757,6 @@ static enum drm_mode_status lt9611_bridge_mode_valid(st= ruct drm_bridge *bridge, const struct drm_display_mode *mode) { struct lt9611 *lt9611 =3D bridge_to_lt9611(bridge); - unsigned long long rate; =20 if (mode->hdisplay > 3840) return MODE_BAD_HVALUE; @@ -765,8 +764,7 @@ static enum drm_mode_status lt9611_bridge_mode_valid(st= ruct drm_bridge *bridge, if (mode->hdisplay > 2000 && !lt9611->dsi1_node) return MODE_PANEL; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); - return bridge->funcs->hdmi_tmds_char_rate_valid(bridge, mode, rate); + return MODE_OK; } =20 static int lt9611_bridge_atomic_check(struct drm_bridge *bridge, --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.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 091471DFDB3 for ; Fri, 22 Nov 2024 09:13:33 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266816; cv=none; b=bViq18Ckgy3vjiSKEBAjGE6s8C2mhX/rvz9lhFZPKn0Vq3+rq5JUWCwO78TwzgtWiJeMr03khdxYm7Cxl6Fpla3Ecf9abL33IoipScJqBqrqjZUvCAkKqKKyzBz3Vl6+s9rqgpAtGiiRjPkN44HCVU0h9c3JTLL70IrEA96shxM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266816; c=relaxed/simple; bh=UjNMLqX51SwfyB+kbUbjnJt95fAbmRoKvLYOPQ8ek9c=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=P5KO0zkKJcXbfgbsPY4RpNMUai1VBxW1AXSgAoTk4VHg4wuO7YSRRCy7JcKuP9SILeAV25uZRT0FLo13mJGDtfxSbP2c3izSGmAZ9/tiMdQ9Ra+6iSpG7b1sgPzHnJndgIG2ci+RIn8kz0Kd1WvyIYAHbXKOMWkOEg7d32Sg7GQ= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=xLO2cSv8; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="xLO2cSv8" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-53dd57589c8so322472e87.1 for ; Fri, 22 Nov 2024 01:13:33 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266812; x=1732871612; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=xLO2cSv89KvvhooBkfbjyNQfv5kXfXWiip+K2cO1UEfx8kZqrJS30LTqghRbTgbxUY x4d74wm9hnuMHJ7FRXkNW3wA6O/TXQontzsooj7Iv1nz23Ss7JHmdRL8D8XxKs8ym47W 9y7wHSV9HPTVMRVrOmSxJzpkrD2C0omhfFqVLVp2FsxoondHYfEq7zXNowVOYJzdxmjg icslnGHKC/YJrwoUxaiN6W8Pzp6BT1ZBGInr2z51iEXtoXoP2y61xLy2EcqriNI6eg7Z +auNXq8N4VFy1zGl6L3s0i5nIKnHE3IF/LJCai5nQlHg9vROGNugbyYlsdTzS87OpOmg WOvw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266812; x=1732871612; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=n9wxCYXwjuFpbEm8J6hnlc7LqgHEUz/bPD6SI90IVR0=; b=Ah6me8vDR8kf7l87Bl86QOEcMs/McoYngPHfCqjtEBe2Bnzt5Z9kC1Hh+o0uL594Rh crxYFMGAPC1+LpgE11OXOWiB8pbZ0lmq1uhNxj2hW/lC8fBOvtbnor/576UAtm4ObfHW GUSR/JIZv1FEI2t8GzsPLxW4H9lor0odBxp9JRgmXHxIGewvO+pjyUyvzcR/9HTvH7Yf XOei1H31jzsXScnAhOeT7YuM+jXgK+/q886ksRFsm/p521XMMaXCaIlyvABiS905qqoM +ENmhutux2Y3ry38M2/+BPAXQPVtfLECKenZ2fE0/kbf+GAi0Mavyg3XWviHIdimvF17 w5QQ== X-Forwarded-Encrypted: i=1; AJvYcCUVcE3JMkFiMenfUSXHUtr9lkdQ2ICU8PgWbQPRhFc/abHE1No33I0shO9tupRDhFleOqPJdVo8MEYr4Zc=@vger.kernel.org X-Gm-Message-State: AOJu0YxKWEwhZgxsN32hF0Iu3j1I8h/jGIcvTsfb/8r4H+ydQ2USHpUS nNIGfa8zgAjNI48hlcLtNmcG7+9yAplCt+269LldI98VkcGe72vjKkGLDdmizUQvhWoT2CP3Cip X X-Gm-Gg: ASbGnct3+TCUv1IgbuT+Dh1wn7V9KRp8uX0CwWgTnEP1n4e8FvpRnW7KT+h5crxA7u9 7UuGcBwWqJUiJrLDAz4XvZt+D7Qx0Ol5ysJh+Hf9MjoJRrsDk/zQtTRIt0hg+2SJRAkvii/hpJZ Gd2H+mlCDyHwbFA0SPnPYDdeK6mePgkhidMo64c3V8NlKXaFyW8mhdZnGEtko/EBT2FLd4+RPuA 7USSdj+rIOXHVvwQZaVofJDDfNQVqMK/x4rDYmi1UhNpGmsHB93xrBxdQ== X-Google-Smtp-Source: AGHT+IGDeNFqG4MBKTEb+7vEM0EHIe+kSHIzZU4cqUcGBYdZXfjh6XYO9X/0YkMh3CxsrBHQKu0dXQ== X-Received: by 2002:a05:6512:ea2:b0:53d:c9ae:a978 with SMTP id 2adb3069b0e04-53dd29c2410mr650169e87.4.1732266811943; Fri, 22 Nov 2024 01:13:31 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:30 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:05 +0200 Subject: [PATCH v4 09/10] drm/bridge: dw-hdmi-qp: replace mode_valid with tmds_char_rate Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-9-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2092; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=UjNMLqX51SwfyB+kbUbjnJt95fAbmRoKvLYOPQ8ek9c=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsinpLwtf2P+iapQrUkEDkXySbQ1SEGNPG+E yMN1AXKzKeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1UAWB/wNkyuzaaWNjb3TQ3pzTEcHC7B/Rpy9L6BOjIvOeuTqTWll9d3zLo9QEE1PDxJLav2S509 /GcNdsoEza+Au8Yx2/cJRv0J8J0BcqhPP6v01atHSxQ/lQESAhnjtbezigKj5F6augKx4qn+hBU 05oVtI6caS1lItX/bI51kj0LEdFXBhJhBE6wQ8+jdC/YQiN6kTW7lFsat02wgdaeNGebhcNB3x5 S4eJMeHGa15XNxAzBSWFbFzktMTFpbMpPra4zPxZpisIFGPMIpdwOSUiRLCP8Z24s4vpMhROld2 EsX+4FEudWGB4pshKsMVn0Zbj+v8pVuawOqXGg9LMIj+ZYLn X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Replace .mode_valid() callback with .hdmi_tmds_char_rate_valid(). It is more generic and is used in other mode validation paths. The rate validation for .mode_valid() will be performed by the drm_bridge_connector code. Reviewed-by: Chen-Yu Tsai Reviewed-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c b/drivers/gpu/drm= /bridge/synopsys/dw-hdmi-qp.c index 181c5164b23192f0b557624d73c6223032b90ec6..c686671e4850a1af75b82995185= ffc3cbb22a447 100644 --- a/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c +++ b/drivers/gpu/drm/bridge/synopsys/dw-hdmi-qp.c @@ -442,16 +442,14 @@ dw_hdmi_qp_bridge_edid_read(struct drm_bridge *bridge, } =20 static enum drm_mode_status -dw_hdmi_qp_bridge_mode_valid(struct drm_bridge *bridge, - const struct drm_display_info *info, - const struct drm_display_mode *mode) +dw_hdmi_qp_bridge_tmds_char_rate_valid(const struct drm_bridge *bridge, + const struct drm_display_mode *mode, + unsigned long long rate) { struct dw_hdmi_qp *hdmi =3D bridge->driver_private; - unsigned long long rate; =20 - rate =3D drm_hdmi_compute_mode_clock(mode, 8, HDMI_COLORSPACE_RGB); if (rate > HDMI14_MAX_TMDSCLK) { - dev_dbg(hdmi->dev, "Unsupported mode clock: %d\n", mode->clock); + dev_dbg(hdmi->dev, "Unsupported TMDS char rate: %lld\n", rate); return MODE_CLOCK_HIGH; } =20 @@ -510,7 +508,7 @@ static const struct drm_bridge_funcs dw_hdmi_qp_bridge_= funcs =3D { .atomic_disable =3D dw_hdmi_qp_bridge_atomic_disable, .detect =3D dw_hdmi_qp_bridge_detect, .edid_read =3D dw_hdmi_qp_bridge_edid_read, - .mode_valid =3D dw_hdmi_qp_bridge_mode_valid, + .hdmi_tmds_char_rate_valid =3D dw_hdmi_qp_bridge_tmds_char_rate_valid, .hdmi_clear_infoframe =3D dw_hdmi_qp_bridge_clear_infoframe, .hdmi_write_infoframe =3D dw_hdmi_qp_bridge_write_infoframe, }; --=20 2.39.5 From nobody Sat Nov 23 23:30:41 2024 Received: from mail-lf1-f43.google.com (mail-lf1-f43.google.com [209.85.167.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 89E0B1DE2CF for ; Fri, 22 Nov 2024 09:13:36 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266818; cv=none; b=odVGRistxP+GAvK5fzah9YAGtAHw8HzkSIAD0g3ZYQfDpIcjhtFmRN08TajDLc6DnzODe78ZN3dEbEaN97NFEuy+FMTN3kVVqzBE6MKfyauYM+tAC8Oi5JssknsXlBAbtWW7SM+MLClEAzCdl0iCEdgu7kzrRH+30VF96OQCqNE= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1732266818; c=relaxed/simple; bh=NRpLumrdDZhSXCJcusWkwzHsBkwvkTsOwVSCIyGYQBU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=TlaJ/IwWFO1O4K0tVlYuyp/QCvLVbLpaVHVn465XYGZKh+j3QD9MToxSDIOZlPzUdW/Z6hs3kRLoc5JY/uWd11etl4ibep54TNX5qQmPmRl/aWl+Vm+zcQH6xU3tLuoFpV+MTCIhcZautn+9MtmaPJW+L+Gjt0air4RJHmYFFWo= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org; spf=pass smtp.mailfrom=linaro.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b=aReSrTav; arc=none smtp.client-ip=209.85.167.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="aReSrTav" Received: by mail-lf1-f43.google.com with SMTP id 2adb3069b0e04-53a007743e7so2078685e87.1 for ; Fri, 22 Nov 2024 01:13:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1732266814; x=1732871614; darn=vger.kernel.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=aReSrTavPmefqiJJxzteHzuaZq2g26wDGcOsg2opcPSdbAgbuEfJI38+quBcGr9wgB 3hoBoliJzrVSEIQJTNTbJU1Zbz3p2Bv05mN71RhBYLXqdzSazeMmMgxaJwZagZL+7jZc Mq0PXfXDY6mfVwDtMafnYPWZKIwOvR2dvymn8dxWCgioKgTflL2JVThbrG9nRAEgp7sH B9ckTVWzSK7sG145LlXik+oUf76t5PbGYoF4lfkN330WrQxZw6b1+5TU78RqNOQ4PvvA vGUxCXnelI8DNGjMViJsGAE7ANDk1v2PL//ZitaEMlzP13qzYjKCUWu6taljJJ7PtyrA aCag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1732266814; x=1732871614; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=L+pN3XKvVFmetq3YJbHAkykp748W6pEN5H4vcdcbZbk=; b=hJlNj+ekQpOZrRe+Ccow02r2xxc3JZmawAdAUe/dg9EullxzoP3/1NsKobZEq64YYh DgUSwtR3AlGdN/PJ0WekxS8+j32rdVhLtQFesezDIH7OQ1q+BsB0AkuhbONXHeL/Zb29 ogi6Sv+QhyNKCkdCuBwNrfopbnonk6s6l2ylQ2nuZUZTUk3Pq6RRAGYzfCJhjPikNfmu 6EmOHGzgNCE0cM9VHbKOWm31XlfLSbqihDfM/CuWPD2mUu61d0bDKnCRhb+3Pn5qrpDF M+Ttlu3BJC7v6bmmLwUO0y0VJ9L3kgX2tbflv1zjuRFHKRseRGD9H8w6kra14jB0r4PX ivNA== X-Forwarded-Encrypted: i=1; AJvYcCXBgOMmNb8NsBWKrqZjMYdwRxbtJQbTHLK5WeVjZNYzvmiMoFxhTQqikUQwFYvlgWRv55deXSNVv8U4Qf8=@vger.kernel.org X-Gm-Message-State: AOJu0YzSyIk2IVQuh8QID+KDxzWpz4mkKv+Ju4YiuKBDVZXzptXfqqzO mgsg3NZMh1TisC13Q63AWP2TcUvG0y2+fsWo7SkuLqDbF9622pXBA7N6ne15Gyot/TU2Fz2ul8e Z X-Gm-Gg: ASbGncung0df3phqcO58+Ey0v9aioHE5z2xYl0622Jm0BaMoX92syGV1xQ8S1W2VDNJ nF7rowOf+FP5wcLlQXh3d+pzPlQyoQDCzTsfWiSwnZPV3FJ7YjmbKNK+d9O66ns3LfZ4+GqFumo yv1MFsXHXxYdhvO4H7MO8uJy6oAiRtWXseCnkCchvJJE/cSwTF7Rf2XtR5rep6WCuA4vJPnLCOT yq0WP/Gkuf9T2+ErgLN6IJVFGxaS6GpvAqpfOGz+Xp/k2a2m92JcPrD0A== X-Google-Smtp-Source: AGHT+IFuPDVVeiIBHBx+sqGVLigoH/J3FctzJhynNILKoVJRUYGgovyLxnstEYxyEorm8Lhl1P2kvQ== X-Received: by 2002:a05:6512:230b:b0:539:f6c4:c29d with SMTP id 2adb3069b0e04-53dd39b4d2bmr879301e87.54.1732266814401; Fri, 22 Nov 2024 01:13:34 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-53dd2451386sm299530e87.77.2024.11.22.01.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 22 Nov 2024 01:13:33 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 22 Nov 2024 11:13:06 +0200 Subject: [PATCH v4 10/10] drm/sun4i: use drm_atomic_helper_connector_hdmi_check() Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Message-Id: <20241122-hdmi-mode-valid-v4-10-2fee4a83ab79@linaro.org> References: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> In-Reply-To: <20241122-hdmi-mode-valid-v4-0-2fee4a83ab79@linaro.org> To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Chen-Yu Tsai , Jernej Skrabec , Samuel Holland , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Canal?= , Raspberry Pi Kernel Maintenance , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman Cc: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@lists.linux.dev X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=2011; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=NRpLumrdDZhSXCJcusWkwzHsBkwvkTsOwVSCIyGYQBU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnQEsiTDOV2BoHyoyOts+0adMkGX+r4MYsJsnPa Far8OQb/72JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ0BLIgAKCRCLPIo+Aiko 1UrVB/4mHUMcziWq1wY32ABnFkVrTROOJMHkHk+6+aK4dszHbnC762R/MtVLV2lOqnA6MnxSNW0 EVuY2bQWv4PVDAZe+RPKyAm1fyLq9OizOUvRo1l12zL/O2139m41O4x3tI0r6uFqif8Pn4rZMCk t2ZMyaLmzPC6ufRtblUgk+VXVLehNTanDBHYRGga0siqsAnC662tRVl9Nf7/u1NOCILS6qYcKel P1sPNcHJSvULZIp9OJpXG/FZB4M7PHg/tR5MlTQzjrj0PWaj0798D+vDyF6eDysiUqnzifGcaGx giuaughGqZtani8SvGv0/wuVrNdnUepnAPAPfoATeqV2sc3E X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Replace sun4i_hdmi_connector_atomic_check(), which performs just TMDS char rate check, with drm_atomic_helper_connector_hdmi_check(), which performs additional checks basing on the HDMI Connector's state. Suggested-by: Maxime Ripard Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c | 20 +------------------- 1 file changed, 1 insertion(+), 19 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c b/drivers/gpu/drm/sun4i= /sun4i_hdmi_enc.c index 54b72fe220afacc208b3fd48d5160031127ea14a..b05fd77870b00aac97d003f3fb9= c2b98cb73abc0 100644 --- a/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c +++ b/drivers/gpu/drm/sun4i/sun4i_hdmi_enc.c @@ -187,24 +187,6 @@ sun4i_hdmi_connector_clock_valid(const struct drm_conn= ector *connector, return MODE_NOCLOCK; } =20 -static int sun4i_hdmi_connector_atomic_check(struct drm_connector *connect= or, - struct drm_atomic_state *state) -{ - struct drm_connector_state *conn_state =3D - drm_atomic_get_new_connector_state(state, connector); - struct drm_crtc *crtc =3D conn_state->crtc; - struct drm_crtc_state *crtc_state =3D crtc->state; - struct drm_display_mode *mode =3D &crtc_state->adjusted_mode; - enum drm_mode_status status; - - status =3D sun4i_hdmi_connector_clock_valid(connector, mode, - conn_state->hdmi.tmds_char_rate); - if (status !=3D MODE_OK) - return -EINVAL; - - return 0; -} - static int sun4i_hdmi_get_modes(struct drm_connector *connector) { struct sun4i_hdmi *hdmi =3D drm_connector_to_sun4i_hdmi(connector); @@ -258,7 +240,7 @@ static const struct drm_connector_hdmi_funcs sun4i_hdmi= _hdmi_connector_funcs =3D { }; =20 static const struct drm_connector_helper_funcs sun4i_hdmi_connector_helper= _funcs =3D { - .atomic_check =3D sun4i_hdmi_connector_atomic_check, + .atomic_check =3D drm_atomic_helper_connector_hdmi_check, .mode_valid =3D drm_hdmi_connector_mode_valid, .get_modes =3D sun4i_hdmi_get_modes, }; --=20 2.39.5