From patchwork Fri Dec 20 19:17:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13917260 Received: from mail-lf1-f46.google.com (mail-lf1-f46.google.com [209.85.167.46]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D0E6E227BAC for ; Fri, 20 Dec 2024 19:17:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.46 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734722245; cv=none; b=ivwL62bjudLUZGV4GD79SkrzRTzAIXNDqkV7UApMCKMsv65zH6jaGh4FLBPW35hjS6pFa8se7xj1p0eXS2AQr6ItHR/722/LGUJ9iXDYDbcX25v/73jDWPOabKz3d5LSL2YE0jZYKgWELi72hfzhHrHXe3LEF41mw+PiUXTqQQc= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1734722245; c=relaxed/simple; bh=qie1G35P6Yl7cippcpWCMVmv6O7BDmJcfLKNOKKg6kE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Mhuq33lwUl3QVk+jqBrYpGEnrgLdjen0vEznAGxgvAR0/PNpK9B56PFpiHvo7JcWTFUQcM+NRRS81uKo4GRtPpGDCntQ2O26gC1xhV4nhJM/mVZRBB2ZDzK8qIX+tNd1J2lnQkXknV31pdB1Sec3H4s9JqQypEVCYMokb9R+v7w= 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=XipsNkqh; arc=none smtp.client-ip=209.85.167.46 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="XipsNkqh" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-5401bd6ccadso2289371e87.2 for ; Fri, 20 Dec 2024 11:17:23 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1734722242; x=1735327042; 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=hqnxj6s3/EgjVuNjxM9/sx/Q8vGKE4sDTiUqotmlFDQ=; b=XipsNkqhyzn7O+inhoOVmYZgLErEg//zGEpouIRy3mikg3OSUY/umrLs0YTf5yL7a3 HYxqCQ7R9PhqQqhswFX5Eqj3bZuvLkCMCeB054aVqtXHHzqmnaOenK2x0gCtnqSNQUC8 ArN0qDtXlTmEyhLtLYeWKz8ZeaNFh2NH3Twl+ZP3FzTHIIlMO+PHQzBjAWiwTOsp65+I WcA9FbE1aT8YBeqkxiOoAmzWeNgiMYZk006zFw/zl1SFzB9SRgSp8eRBUJnyVrY0yLJl dnn8TkVcfQ7cvpLhO+2Hiz06UGuehfh0q37efPT6m3a6eQH32YhHqScfOLfUxtr2N/BI nN6g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1734722242; x=1735327042; 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=hqnxj6s3/EgjVuNjxM9/sx/Q8vGKE4sDTiUqotmlFDQ=; b=hjhmHYU8CSkn3WXFo8zBxzlgnys3Trt4OcsTSFZ2m497rmkgwORumYWdRvZVYlOCGl SrEhzJu38Bml8tChsHRYn2rjG0qYZtMGL6C581l9y7O79aHdmuZUN2R2SjQ4rnYI3XsQ 6NiCL1dBCX9UdH7rVb2Xb277eEbClTqySX/aoUIDssW+sLEJZPVqE+K5yZjGx/m58+Pv 9jxfw+TQqqJwGhWM2auSN4KHYjDLVK79f4x+W7wbElxHEjI0p2Ii4GFq6l512VoKPi9L rylEUaLAdnie90ge6RpzJjT2SfEKkKSA3JIP3ZgSGoiRMLyZDX3+TkTzn4pPiUfdWBGV VMdg== X-Forwarded-Encrypted: i=1; AJvYcCWzQJwFn74rouV2CslMLYdsh+hkE6NX1alTCMSzcFka5B6yqDxmAiWLt7gST4O9Hi2FaPYo1V6W9KOrDw==@vger.kernel.org X-Gm-Message-State: AOJu0YyuYxhcNl8en9h1oFjOsi0SuJ4RGVPCFK1GiJLEne/7IvLah7h7 MruGrFSGqeASeORFg7LwDEyC2NELM4wmPE+2jShMyYFNukWRhoUmQxIEKJ3XkvA= X-Gm-Gg: ASbGnctcfNAHl/NnKWNbmL1wZ+hZmktqqAFZ59jsjrzmEer5KC1xcBaJjsdTYvFzAb9 cxPlKFCugLiGzRQ4NJ21yQo5Wz7qm6roqeVQDfdpuEW2HikyeIwvhNtAmxAldl6epqzHpKyCNbL 9xFGD8aWfeVrRd3ZR5JeN8sGgrrBFaZb4A+b9fVqvzUh+mAFm+0AYYZ1lbm++ruSrgJDswSea/1 /0FoEwR+jASZPi4xDYY6qEIBqajMRUo6Bh22IxJ78jYAJO0bf9U1TkksphYPtBC X-Google-Smtp-Source: AGHT+IEptTJIjjBHJb6drHS6Ssf3ip8D9nli87J1i3Tl5U5BIoRVUbAgr22Q8lEZaYRdhxbZ2aDt2A== X-Received: by 2002:a05:6512:ba9:b0:542:232c:d3eb with SMTP id 2adb3069b0e04-54229530111mr1143607e87.19.1734722241963; Fri, 20 Dec 2024 11:17:21 -0800 (PST) Received: from umbar.lan ([192.130.178.90]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-54223813877sm545141e87.149.2024.12.20.11.17.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 20 Dec 2024 11:17:20 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 20 Dec 2024 21:17:04 +0200 Subject: [PATCH v8 07/10] drm/bridge_connector: hook drm_atomic_helper_connector_hdmi_hotplug() Precedence: bulk X-Mailing-List: linux-sound@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20241220-drm-bridge-hdmi-connector-v8-7-2399dbae2990@linaro.org> References: <20241220-drm-bridge-hdmi-connector-v8-0-2399dbae2990@linaro.org> In-Reply-To: <20241220-drm-bridge-hdmi-connector-v8-0-2399dbae2990@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Simona Vetter , Jaroslav Kysela , Takashi Iwai , Liam Girdwood , Mark Brown , Phong LE , Inki Dae , Seung-Woo Kim , Kyungmin Park , Krzysztof Kozlowski , Alim Akhtar , Russell King , Chun-Kuang Hu , Philipp Zabel , Matthias Brugger , AngeloGioacchino Del Regno , Sandy Huang , =?utf-8?q?Heiko_St=C3=BCbner?= , Andy Yan , Alain Volmat , Raphael Gallais-Pou , Dave Stevenson , =?utf-8?q?Ma=C3=ADra_Cana?= =?utf-8?q?l?= , Raspberry Pi Kernel Maintenance Cc: Jani Nikula , dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org, linux-sound@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org, linux-mediatek@lists.infradead.org, linux-rockchip@lists.infradead.org X-Mailer: b4 0.14.2 X-Developer-Signature: v=1; a=openpgp-sha256; l=4313; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=qie1G35P6Yl7cippcpWCMVmv6O7BDmJcfLKNOKKg6kE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBnZcKvRQ1DyEvUZ1bVLVKWFGtt2tlzDFohZ6VEy cv513jnLgOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZ2XCrwAKCRCLPIo+Aiko 1VZZB/48AgSV1kDPiMY882P+b8lEru7SsHx6YLD9T1fz/l553VfG8tGAZ4zSgd8lyhfFF3Ugvw4 zy5oID9hdz885xTx+UUeywPsD2hrB/WzGlsawx1pwmKboE6XIU214KCydAEFuFXTAb1Ncd1P4T/ TqQvi7thRLweENmH/lapmF6aDNJ74rfeJrrgZTzyf6rjNMkOzMvwFjg03adlbeISOAYcjf993ja 6H5af0Us6KBcRMkdKLbmesZB0TGqYhynDCbOVjJid3zmoIDD35wUb/CdkzrFHTDQUebxUfzdD9x TPLhFJiPj9m/4tUNtSPH40RcFpTeoTCnjwALIZ68OmXM++JX X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Extend drm_bridge_connector code to read the EDID and use it to update connector status if the bridge chain implements HDMI bridge. Performing it from the generic location minimizes individual bridge's code and enforces standard behaviour from all corresponding drivers. Reviewed-by: Maxime Ripard Tested-by: Dave Stevenson Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/display/drm_bridge_connector.c | 39 ++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) diff --git a/drivers/gpu/drm/display/drm_bridge_connector.c b/drivers/gpu/drm/display/drm_bridge_connector.c index cc955ee008d843d73fedb891e97143a4168fd311..66e4ab81fa0c2717490193e896389757f0a903f2 100644 --- a/drivers/gpu/drm/display/drm_bridge_connector.c +++ b/drivers/gpu/drm/display/drm_bridge_connector.c @@ -17,6 +17,7 @@ #include #include #include +#include #include #include #include @@ -180,11 +181,15 @@ drm_bridge_connector_detect(struct drm_connector *connector, bool force) struct drm_bridge_connector *bridge_connector = to_drm_bridge_connector(connector); struct drm_bridge *detect = bridge_connector->bridge_detect; + struct drm_bridge *hdmi = bridge_connector->bridge_hdmi; enum drm_connector_status status; if (detect) { status = detect->funcs->detect(detect); + if (hdmi) + drm_atomic_helper_connector_hdmi_hotplug(connector, status); + drm_bridge_connector_hpd_notify(connector, status); } else { switch (connector->connector_type) { @@ -203,6 +208,16 @@ drm_bridge_connector_detect(struct drm_connector *connector, bool force) return status; } +static void drm_bridge_connector_force(struct drm_connector *connector) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *hdmi = bridge_connector->bridge_hdmi; + + if (hdmi) + drm_atomic_helper_connector_hdmi_force(connector); +} + static void drm_bridge_connector_debugfs_init(struct drm_connector *connector, struct dentry *root) { @@ -231,6 +246,7 @@ static void drm_bridge_connector_reset(struct drm_connector *connector) static const struct drm_connector_funcs drm_bridge_connector_funcs = { .reset = drm_bridge_connector_reset, .detect = drm_bridge_connector_detect, + .force = drm_bridge_connector_force, .fill_modes = drm_helper_probe_single_connector_modes, .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, @@ -276,6 +292,14 @@ static int drm_bridge_connector_get_modes(struct drm_connector *connector) to_drm_bridge_connector(connector); struct drm_bridge *bridge; + /* + * If there is a HDMI bridge, EDID has been updated as a part of + * the .detect(). Just update the modes here. + */ + bridge = bridge_connector->bridge_hdmi; + if (bridge) + return drm_edid_connector_add_modes(connector); + /* * If display exposes EDID, then we parse that in the normal way to * build table of supported modes. @@ -368,10 +392,25 @@ static int drm_bridge_connector_write_infoframe(struct drm_connector *connector, return bridge->funcs->hdmi_write_infoframe(bridge, type, buffer, len); } +static const struct drm_edid * +drm_bridge_connector_read_edid(struct drm_connector *connector) +{ + struct drm_bridge_connector *bridge_connector = + to_drm_bridge_connector(connector); + struct drm_bridge *bridge; + + bridge = bridge_connector->bridge_edid; + if (!bridge) + return NULL; + + return drm_bridge_edid_read(bridge, connector); +} + static const struct drm_connector_hdmi_funcs drm_bridge_connector_hdmi_funcs = { .tmds_char_rate_valid = drm_bridge_connector_tmds_char_rate_valid, .clear_infoframe = drm_bridge_connector_clear_infoframe, .write_infoframe = drm_bridge_connector_write_infoframe, + .read_edid = drm_bridge_connector_read_edid, }; static int drm_bridge_connector_audio_startup(struct drm_connector *connector)