From patchwork Thu Mar 7 23:57:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 778896 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 6631E45031 for ; Thu, 7 Mar 2024 23:57:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855828; cv=none; b=Bhmg4d+muQdR2ClC0kEvyTJIdcQM/U0zLAvsAIBlZj/b50LY8UvVLt9afYO0aFvjUOKgcfFTDQlMk6VgJIFQ92a87wNIP/xGuNNw8IvXXN3Yd39qGGeL3BIPY8Ww7Cdmp+wWOsEBUv0bNGJJns3yyLhRdzLtc90wEzcECHhoq7w= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855828; c=relaxed/simple; bh=y1yNIKWYKop4uPXPLUnZdxDiseRQwHNWzmdOCItrwFs=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=qDIEMPgk/7C5mXOlcABZZ3QK0XLZtBGj0zUExZJjBSNtW4PO3pfSRXFPsQIU29Si2kzn+t0gCPAjERKq2g5mBP4cdRTOiN23v/zykoBEDLOr4S7mnmDohhUjWO+/gUy2E7uYrr4jqEkyE6IO9WA+6q+72vyJhqzVCwxZ4KtyW7U= 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=TeuO6Ooo; arc=none smtp.client-ip=209.85.167.49 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="TeuO6Ooo" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-513382f40e9so1819548e87.2 for ; Thu, 07 Mar 2024 15:57:06 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855824; x=1710460624; 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=9ayfDGuEZEO1ZfQYO+0AykFZJxnVQjKjfpqW7Vdx2QQ=; b=TeuO6OooP0sJkMc1KSFBU/L+rZzXEQF1zpECAh0LhwdtyOcvSWgW/B2EUaK+EWQ8Lj R7LjtX5hEzB57Sls7xBb7+b/3vUzAu9Atxo2TBmz3TNRnKvfq2hjupNq6zZ8V302kBBC A0bet76jYhsKLqNQuj1veaYW7/9wGlRz8BJKZ0fC5473IRVzueM70Ka4KzPL4Bu+Rr8y zhayRleLZqOPGreph+YPmHN4/iD4CJdcFiztunC7+RVe0Zq+ZobDgrU8Pfa482HTC/sB 2Eg2xecYjUGGkfhBCtl7f7RGhVVydZt2toHJtX2ZpdpqAS2BR7miQZwZubuV9Bu4zg6+ JxWg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855824; x=1710460624; 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=9ayfDGuEZEO1ZfQYO+0AykFZJxnVQjKjfpqW7Vdx2QQ=; b=FpeYQwFcxfBOcHavjtApgMWfrpTj/wnUqM0VtTqy06ZOe/ADUpDg6aGPA5E/2T8qHy VigXfhscru7/kBcnNIQiMDlrk/G7v7/e2hULD8r6lNkHduGp8K+4RRVnjM7id3SUx3Bo ACM1utp0R1yKiKfBFA87cA3q9yDS8fQAF6lfiKH2f8wgjSMnw3LdOkt1PH2p4ApS4Roo nJc2Ui4ekdxN44oZu1zdVou6Ckez2n01Ci5q+d29mxRdaX3MOw/jChYaC9O7U8uy3o5B bbN4jZZhq64G4jG5/bvRvGar5ZRETUZyUL95ietAc7SrckomWW9dLzhmZTq0OYlVpWFZ Dr1w== X-Forwarded-Encrypted: i=1; AJvYcCWZK1gh/rhWzTn3ENrasSMI2qxIJY8RpDJgclF26uheJAEXaNFNqq44s0fWYSQ3COw0NCLeFiEX+2aDxaQQkJoUFapYPmasMJrN+iBHLA== X-Gm-Message-State: AOJu0YyWP0kyiPW4vEOHA4+f/9UT5wu6fvmEOJE7xHPjnAqN5rHn4rjF gdb8/ytclTwWaQhgJH7eYoDph8eQ8EEPsB+XuE035AmhKyTU4Xm1DZhIeT7U4/o= X-Google-Smtp-Source: AGHT+IH2kQosbGZQ82H2J6neyNEH81RoEbRElVkt21vFS8NHxY1NWgIZxQ7OeyErKOM7z4rHO0C7aQ== X-Received: by 2002:ac2:47ef:0:b0:513:28bc:cd0f with SMTP id b15-20020ac247ef000000b0051328bccd0fmr2377793lfp.27.1709855824449; Thu, 07 Mar 2024 15:57:04 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:04 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:00 +0200 Subject: [PATCH RFC 1/6] drm/bridge: add setup_connector callback Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-1-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3989; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=y1yNIKWYKop4uPXPLUnZdxDiseRQwHNWzmdOCItrwFs=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lRNhMQfYajWwExGw9+woYoxcDvNbM6i1meDI SLAUtWy3OmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTQAKCRCLPIo+Aiko 1W3zB/9UDY1bM4y8J3cTIY3/oV8UwEYqWEvYFmJyzBsFf6GzwU+tj6FEnRJabk/yUDRX+VVM2f2 De/vcYY31UhhTF8vO50+y7dmAbbVVrx3g+E1+mdXJRSKSmp0rfQAncbyy79ChDA0qrrmXcAjml1 t57dl/Fe7dxexIdX7fNIDsi2IjRyctg6k0YxREnPItglhyQ1nlIEq5lOAh5+P1O6uSGyt9vUhkC ZetdBzimHLfgIO/YJCrTiAcf/StrmlkxTgCdyMpTQ+rrOTEdn4rcUlA7drNS4CbM4QatRfNbGjN tnofB98OxEGfK10iklF8jfGO8yOucWFX2ycyt9bIC+2X497b X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Add a callback to be called by the drivers when the drm_connector is created at the end of the drm_bridge chain. This allows bridges to perform additional setup, like setting up the HDMI connector properties. Note, for now only drm_bridge_connector uses this callback. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_bridge.c | 38 ++++++++++++++++++++++++++++++++++ drivers/gpu/drm/drm_bridge_connector.c | 8 +++++++ include/drm/drm_bridge.h | 15 ++++++++++++++ 3 files changed, 61 insertions(+) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 521a71c61b16..375982a02bcf 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -580,6 +580,44 @@ void drm_bridge_chain_mode_set(struct drm_bridge *bridge, } EXPORT_SYMBOL(drm_bridge_chain_mode_set); +/** + * drm_bridge_chain_setup_connector - call all bridges to perform additional setup + * of the attached drm_connector + * @bridge: bridge control structure + * @connector: connector that is used at the end of the bridge chain + * + * Calls &drm_bridge_funcs.setup_connector for all the bridges in the encoder + * chain, starting from the first bridge to the last. If at least one bridge + * does not accept the connector the function returns the error code. + * + * Note: the bridge passed should be the one closest to the encoder. + * + * RETURNS: + * Zero on success, error code on failure + */ +int drm_bridge_chain_setup_connector(struct drm_bridge *bridge, + struct drm_connector *connector) +{ + struct drm_encoder *encoder; + int ret; + + if (!bridge) + return 0; + + encoder = bridge->encoder; + list_for_each_entry_from(bridge, &encoder->bridge_chain, chain_node) { + if (!bridge->funcs->setup_connector) + continue; + + ret = bridge->funcs->setup_connector(bridge, connector); + if (ret) + return ret; + } + + return 0; +} +EXPORT_SYMBOL(drm_bridge_chain_setup_connector); + /** * drm_atomic_bridge_chain_disable - disables all bridges in the encoder chain * @bridge: bridge control structure diff --git a/drivers/gpu/drm/drm_bridge_connector.c b/drivers/gpu/drm/drm_bridge_connector.c index 982552c9f92c..a0d0d2cc72c7 100644 --- a/drivers/gpu/drm/drm_bridge_connector.c +++ b/drivers/gpu/drm/drm_bridge_connector.c @@ -402,6 +402,14 @@ struct drm_connector *drm_bridge_connector_init(struct drm_device *drm, if (panel_bridge) drm_panel_bridge_set_orientation(connector, panel_bridge); + ret = drm_bridge_chain_setup_connector(drm_bridge_chain_get_first_bridge(encoder), + connector); + if (ret) { + drm_connector_cleanup(connector); + kfree(bridge_connector); + return ERR_PTR(ret); + } + return connector; } EXPORT_SYMBOL_GPL(drm_bridge_connector_init); diff --git a/include/drm/drm_bridge.h b/include/drm/drm_bridge.h index 3606e1a7f965..9806fce126f2 100644 --- a/include/drm/drm_bridge.h +++ b/include/drm/drm_bridge.h @@ -84,6 +84,19 @@ struct drm_bridge_funcs { */ void (*detach)(struct drm_bridge *bridge); + /** + * @setup_connector: + * + * Perform additional setup of the connector once it is created. + * + * The @setup_connector callback is optional. + * + * RETURNS: + * + * Zero on success, error code on failure. + */ + int (*setup_connector)(struct drm_bridge *bridge, struct drm_connector *connector); + /** * @mode_valid: * @@ -877,6 +890,8 @@ void drm_atomic_bridge_chain_pre_enable(struct drm_bridge *bridge, struct drm_atomic_state *state); void drm_atomic_bridge_chain_enable(struct drm_bridge *bridge, struct drm_atomic_state *state); +int drm_bridge_chain_setup_connector(struct drm_bridge *bridge, + struct drm_connector *connector); u32 * drm_atomic_helper_bridge_propagate_bus_fmt(struct drm_bridge *bridge, From patchwork Thu Mar 7 23:57:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 778545 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 7CCB41D698 for ; Thu, 7 Mar 2024 23:57:07 +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=1709855829; cv=none; b=pbBT9B/6s8YQzShlszkjnHRWLIG9LhTnbNS/d3QvRf3uFa6WNOLeAG+NumTlRD5HcwoM7DHk3TayOCJYfX19SRWUEtTcp2ZOqCvnYgzj2/XZaapPD9J1j3teFXhxxgAGfZxyPkSrBos3bcfMrdeZSCdhsMEkZN7fMoz5njr8r6I= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855829; c=relaxed/simple; bh=0xTy7u4ldl8TibzkLZodtG0AmzrH8EDBIk+OF9QReyQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=DjqOu5Sf/aBFj/fOlwTFMDA+C/d6jEQteGM8T+s4Nmn6LhBGRvJ45+lieVCEyf5kxW+teD2DHmybMK3BlzpeFwGfu+/ct8z5Z1jcz9GtNyCH0B1RiDgahsgRCA0s+LqcqYvpO08KDJwpVQe/JDcfW1UB7Ags3XLAdZ0QWoT5lqk= 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=F/0AZBAU; 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="F/0AZBAU" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-51326436876so1952447e87.1 for ; Thu, 07 Mar 2024 15:57:07 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855825; x=1710460625; 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=YrWVSqhIZg5i9GRohJrsO0PLTsaI98ZgAO0O1ROuapU=; b=F/0AZBAU1RS6struOKMwq7fRGhqodeHjBKV9nOyR9lALea5dfjwfkOaHinpKL2ohq+ ku/ZqPfhhrAwp3JCUzUJqbhzOuJcjC5wWZLXG66qYCTEDKUpWP8KNvPywyP5K5R5/DZw Pm7wnaI8Q7L8tbRo3MXcKiQn6Zh9ErTvewG3xLbkykYWxlbWugFy3NVmfnvJu+CPSPzE hCYkW2697XTRtV1ns9ytYI/FFlr1Ut6z0UUiraEkZ323ia/1OvNO1KNTZv3rPTH1sUX9 2xbPP0JeVZNzz3UZ+oY/0gY3EHY7oFodIMJ29LD0M0NZcTvJeipVIqbIutES2UuXBaNt 5WmQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855825; x=1710460625; 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=YrWVSqhIZg5i9GRohJrsO0PLTsaI98ZgAO0O1ROuapU=; b=i3Kp1s3UpcD9IY9wkp596lnZtviqiUJ04wkqrUqZyCPfnPw+va+E+nVSV3Pe7KVQFk J52RLDeivBwPzNbfKp+NtbXPKCsg4DZNL0LO4AjPttdG4vjnmtSXKHyKO/FSipgPL9nt eLS4lSX3tZLeWFQFezSL5elTkR6UTO+eeL/IQdKfRo4G9EEjR541tV4+LKuJvpQhfBin 27ItKo5a8gv4XrGZWzlX6k8nc73Fe1eQ/Lxf8J/3nS9I4Za9OCtYsc+UYfqTZCJnwrQv 90TRp8unY2sZQhgWhoEYgUDXDUvNTN8SCHhbhL1M673mG7Qj075rWs6npLCoyfnJX1in uNeg== X-Forwarded-Encrypted: i=1; AJvYcCVgIanglt//omj9zqfT9Ja7KP5vuHk2sRBTqVxCe5Yy8uhnq3HqowPqzctwkAL35aL00vjE12iWX3f4iXih0B2/Cxob3PvozJsPOD7mLg== X-Gm-Message-State: AOJu0Yy5K965R6WsXvDq1YueYG/aaYoubHbgLQkuNRf3skjCs2V9TMME bZD3kaRkKzPvej5UIqXzRfASgCnoczPkuh9HiLflOYAMvLwk0sllxu8FlfQZ+wo= X-Google-Smtp-Source: AGHT+IGuA3HpzTHNMT/KEhcYh1+21MTcVQqktl2nFqKCMu6Crq3nALckLhb8llyF03hWv2ZWQZuwwQ== X-Received: by 2002:a19:5f5d:0:b0:513:202b:9001 with SMTP id a29-20020a195f5d000000b00513202b9001mr2415854lfj.6.1709855825593; Thu, 07 Mar 2024 15:57:05 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:04 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:01 +0200 Subject: [PATCH RFC 2/6] drm/connector: hdmi: fix Infoframes generation Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-2-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2268; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=0xTy7u4ldl8TibzkLZodtG0AmzrH8EDBIk+OF9QReyQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lROOz11Yb17TBIupmYO+n6/3qc16U9eNuJjU v4r2QckfeOJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTgAKCRCLPIo+Aiko 1YZLCACtlXPIfPPPrGFH+Nz6Yjy0fxuNUleNqH5GonV4FFU/dYWXJRxcS/bVgNct+zcEbgumRv8 vczi52rS1IMlex9j9k8OdBEvaHhuF8LurhDtgMtGS6C8f0G1CrXOoQyCKLOH8rY6LTe+U2hZmtx 5DMbvRfXvZTxVMnt4igberndjzbs8fbLcNzWr+1DA/pZhnLoDOjw82O39bL3Xt6S5+EHcMz23uV AEWZ3i7NJvubGENtn8kAWZb3gkpWSjTiyzcR0n+rdD46gKCWATosfrv0Jzla7dXnqC3lsg2V3WU 49VrOdL7kXp08E2zPFTkScLuhyCIPfeXMezHaGI2QRapFENz X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Gate only HDMI Vendor Infoframe generation on the info->has_hdmi_infoframe. All other infoframes were defined in earlier HDMI specs and should be generated by default. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_atomic_state_helper.c | 25 ++++++++++--------------- 1 file changed, 10 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/drm_atomic_state_helper.c b/drivers/gpu/drm/drm_atomic_state_helper.c index 46d9fd2ea8fa..691efce9661a 100644 --- a/drivers/gpu/drm/drm_atomic_state_helper.c +++ b/drivers/gpu/drm/drm_atomic_state_helper.c @@ -1025,9 +1025,6 @@ hdmi_generate_infoframes(const struct drm_connector *connector, if (!info->is_hdmi) return 0; - if (!info->has_hdmi_infoframe) - return 0; - ret = hdmi_generate_avi_infoframe(connector, state); if (ret) return ret; @@ -1045,9 +1042,11 @@ hdmi_generate_infoframes(const struct drm_connector *connector, if (ret) return ret; - ret = hdmi_generate_hdmi_vendor_infoframe(connector, state); - if (ret) - return ret; + if (info->has_hdmi_infoframe) { + ret = hdmi_generate_hdmi_vendor_infoframe(connector, state); + if (ret) + return ret; + } return 0; } @@ -1208,9 +1207,6 @@ int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *con if (!info->is_hdmi) return 0; - if (!info->has_hdmi_infoframe) - return 0; - mutex_lock(&connector->hdmi.infoframes.lock); ret = UPDATE_INFOFRAME(connector, old_state, new_state, avi); @@ -1233,9 +1229,11 @@ int drm_atomic_helper_connector_hdmi_update_infoframes(struct drm_connector *con if (ret) goto out; - ret = UPDATE_INFOFRAME(connector, old_state, new_state, hdmi); - if (ret) - goto out; + if (info->has_hdmi_infoframe) { + ret = UPDATE_INFOFRAME(connector, old_state, new_state, hdmi); + if (ret) + goto out; + } out: mutex_unlock(&connector->hdmi.infoframes.lock); @@ -1269,9 +1267,6 @@ drm_atomic_helper_connector_hdmi_update_audio_infoframe(struct drm_connector *co if (!info->is_hdmi) return 0; - if (!info->has_hdmi_infoframe) - return 0; - memcpy(&infoframe.data, frame, sizeof(infoframe.data)); infoframe.set = true; From patchwork Thu Mar 7 23:57:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 778895 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 599A03D971 for ; Thu, 7 Mar 2024 23:57:08 +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=1709855830; cv=none; b=Zi0LGVKDUV1hnVy2TC3XJvGswg4a554m7sj6npAPS4D0ytDS+/xQK788H8h8UN4hz9/iIgNv+recBukwHa3JA2bxkcqjPizRFgTX+1juTavLm7jojKVAkSLvhrFDurWqE3yWaoJeOffZw/NTrdf08a2cQfWvXJHLfZHszdGQu08= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855830; c=relaxed/simple; bh=ShiNv393ZQOFkQ1UT0mY5i+Ny9G4ynWKMDoiCyzGxCA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=lp6O/Nqqf0SrPP7POUTvOR7fAXtWmqkH7EUDRogzRu1xZaq9BMFbRnaEL7NWkRAjXB5LR6esXSvwEZ3Avl2gahoVc2bDmUNr6LKXD3j4M/FDgLCdFTtHSLzdpQaEDkZpXMMNLe3yIcOxHlmC9Fm6Ys+bVZBLTsaBrIISk7NxU1M= 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=Jt3QTKVa; 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="Jt3QTKVa" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-513382f40e9so1819581e87.2 for ; Thu, 07 Mar 2024 15:57:08 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855826; x=1710460626; 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=gY2QKi3iCCRu3R9ogdJP6Bt7K1zFE2wWgrj56u+POKc=; b=Jt3QTKVaj3accRGBMObUJHkQeH8JUpEG1oiymcWo0WtRf8avUqbTwUpvIHB72rTjsK RxvXd9VvFWwJABSjUdC8ZsBb+Iq5DaISx7XJ8gAfmuQkrb1+WAa12ueIs8nHJ2W++D0B 3n1z4UVXcJ6rCrXZRfpb93yR/h8vQyDuh6Pu03z/vZYBPhDgkmoAQXtzNXr3+udQ1KpW Jgf9+6JzYoWjDmXCM0/srfj3bG6hD8r9rqe8nt1X0tspih9zUmoKgnhr0K0G1nmi9a7/ ayN5D9lL9Va2n8HVzpCAfHgN384cVk+JvTrfXNTmFzCmkpLHXQDSnJhq33DHG4E/2bhF 77+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855826; x=1710460626; 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=gY2QKi3iCCRu3R9ogdJP6Bt7K1zFE2wWgrj56u+POKc=; b=kFdb2+zU34+cx5/A0IJ15tmw994jtp3LGMpGdYhDbRBr97beocZejZEnN0EeFqWHbR uxJB2GjpLRIv4PpCoy5VL9Um7QXiwAlZQiOa1f9LEcyrf/UC29nqWdhGtw77h4NHLfYz WgcfQqe5NLVk9NDKoxasBK8J69M+4Xwz3c2++oaVs53ZAFj7g8zyQDfPhXoOR8QRwAd2 tVMxl+lnpmA2tdNY2MXCo9ITqvtb8TlfheoSpFodT8CxC754qCvmQQGFLYPRoX9zMgOR 57F9ji8YMKnPGfhsWP0jTQrWJ+dmXVaRn8RW7m75AZYxstrK/wfrpvUKXr3U9sMo/hTo NujQ== X-Forwarded-Encrypted: i=1; AJvYcCVTF239sxqfEyw3TT1tTTX7YahI5PkAnVN+LbA6fTGnaTiKiEqET/53ZvwL8C15Azv1BjwPrY9atuA0QlbYQgez/T/NV9tscTzX9cLexw== X-Gm-Message-State: AOJu0YxLH5q1GFw09bo7hiCxvYkoyOWVWhro4XhVT9DJtYsPLrw8GtWY BgmCLvFbt3ut8Tazi60nN2Ud+d9OfhHZoeu/JqxVx5lt+/LxMAo8Ldeh1+7pHjw= X-Google-Smtp-Source: AGHT+IEIYUwPWtmGW03RHbhLgl9+/GiaPgeGoRsjiKtdQa8Q6FcZOlnaaNwIQLUkOMUVGlYcZzqhtA== X-Received: by 2002:a05:6512:3aa:b0:513:1551:e6 with SMTP id v10-20020a05651203aa00b00513155100e6mr2176294lfp.50.1709855826517; Thu, 07 Mar 2024 15:57:06 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:05 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:02 +0200 Subject: [PATCH RFC 3/6] drm/connector: hdmi: split setup code of the HDMI connector Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-3-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5714; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=ShiNv393ZQOFkQ1UT0mY5i+Ny9G4ynWKMDoiCyzGxCA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lROJ6e2b1AVujzHUbjQVLrDEaTD481Rxbyny tZQJKp1V+2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTgAKCRCLPIo+Aiko 1cVXB/42MRj2IrAMaxs8DpjGlZ1Q8ayl7IKSsS9Ib06j1TA+bAJnmNt2I3BsgWIW8kdOLHhqCy2 kxUY09yWNS+7cvdkwuuOHBjv1AX/MJ/a4jKisWfw8yfRkvKfpeHccoT1D84cWlnln7eyGttXuNm QkbRRLfLhQBmifiR/Xw+97wbnb34bunzINBHxz8wKJ3Tp281N38bbFlE589UuiIr9LpCexqjvAo 7xJaHNDIlVkBDZTwmMn9v60pBssiEIheo53N1zgFgidVCmzpApG5KUk49wtPFJNLtEtrBKVnsK7 SQSd7kbtbWwPqWcHgmks4MDDmkgLdHqBUnpyDr45wAR3HrhJ X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A In order to use HDMI connector extensions from the bridge drivers, carve out the drm_connector_hdmi_setup() from drmm_connector_hdmi_init(). This way the drm_bridge drivers can call new function from their setup_connector callbacks. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/drm_connector.c | 67 ++++++++++++++++++++++++++++++----------- include/drm/drm_connector.h | 5 +++ 2 files changed, 54 insertions(+), 18 deletions(-) diff --git a/drivers/gpu/drm/drm_connector.c b/drivers/gpu/drm/drm_connector.c index 427816239038..ba953eb45557 100644 --- a/drivers/gpu/drm/drm_connector.c +++ b/drivers/gpu/drm/drm_connector.c @@ -454,15 +454,11 @@ int drmm_connector_init(struct drm_device *dev, EXPORT_SYMBOL(drmm_connector_init); /** - * drmm_connector_hdmi_init - Init a preallocated HDMI connector - * @dev: DRM device + * drm_connector_hdmi_setup - Init a preallocated HDMI connector * @connector: A pointer to the HDMI connector to init * @vendor: HDMI Controller Vendor name * @product: HDMI Controller Product name - * @funcs: callbacks for this connector * @hdmi_funcs: HDMI-related callbacks for this connector - * @connector_type: user visible type of the connector - * @ddc: optional pointer to the associated ddc adapter * @supported_formats: Bitmask of @hdmi_colorspace listing supported output formats * @max_bpc: Maximum bits per char the HDMI connector supports * @@ -477,18 +473,12 @@ EXPORT_SYMBOL(drmm_connector_init); * Returns: * Zero on success, error code on failure. */ -int drmm_connector_hdmi_init(struct drm_device *dev, - struct drm_connector *connector, +int drm_connector_hdmi_setup(struct drm_connector *connector, const char *vendor, const char *product, - const struct drm_connector_funcs *funcs, const struct drm_connector_hdmi_funcs *hdmi_funcs, - int connector_type, - struct i2c_adapter *ddc, unsigned long supported_formats, unsigned int max_bpc) { - int ret; - if (!vendor || !product) return -EINVAL; @@ -496,8 +486,8 @@ int drmm_connector_hdmi_init(struct drm_device *dev, (strlen(product) > DRM_CONNECTOR_HDMI_PRODUCT_LEN)) return -EINVAL; - if (!(connector_type == DRM_MODE_CONNECTOR_HDMIA || - connector_type == DRM_MODE_CONNECTOR_HDMIB)) + if (connector->connector_type != DRM_MODE_CONNECTOR_HDMIA && + connector->connector_type != DRM_MODE_CONNECTOR_HDMIB) return -EINVAL; if (!supported_formats || !(supported_formats & BIT(HDMI_COLORSPACE_RGB))) @@ -506,10 +496,6 @@ int drmm_connector_hdmi_init(struct drm_device *dev, if (!(max_bpc == 8 || max_bpc == 10 || max_bpc == 12)) return -EINVAL; - ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc); - if (ret) - return ret; - connector->hdmi.supported_formats = supported_formats; strtomem_pad(connector->hdmi.vendor, vendor, 0); strtomem_pad(connector->hdmi.product, product, 0); @@ -531,6 +517,51 @@ int drmm_connector_hdmi_init(struct drm_device *dev, return 0; } +EXPORT_SYMBOL(drm_connector_hdmi_setup); + +/** + * drmm_connector_hdmi_init - Init a preallocated HDMI connector + * @dev: DRM device + * @connector: A pointer to the HDMI connector to init + * @vendor: HDMI Controller Vendor name + * @product: HDMI Controller Product name + * @funcs: callbacks for this connector + * @hdmi_funcs: HDMI-related callbacks for this connector + * @connector_type: user visible type of the connector + * @ddc: optional pointer to the associated ddc adapter + * @supported_formats: Bitmask of @hdmi_colorspace listing supported output formats + * @max_bpc: Maximum bits per char the HDMI connector supports + * + * Initialises a preallocated HDMI connector. Connectors can be + * subclassed as part of driver connector objects. + * + * Cleanup is automatically handled with a call to + * drm_connector_cleanup() in a DRM-managed action. + * + * The connector structure should be allocated with drmm_kzalloc(). + * + * Returns: + * Zero on success, error code on failure. + */ +int drmm_connector_hdmi_init(struct drm_device *dev, + struct drm_connector *connector, + const char *vendor, const char *product, + const struct drm_connector_funcs *funcs, + const struct drm_connector_hdmi_funcs *hdmi_funcs, + int connector_type, + struct i2c_adapter *ddc, + unsigned long supported_formats, + unsigned int max_bpc) +{ + int ret; + + ret = drmm_connector_init(dev, connector, funcs, connector_type, ddc); + if (ret) + return ret; + + return drm_connector_hdmi_setup(connector, vendor, product, hdmi_funcs, + supported_formats, max_bpc); +} EXPORT_SYMBOL(drmm_connector_hdmi_init); /** diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 5964ef283022..37d54d5ff0d6 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -2156,6 +2156,11 @@ int drmm_connector_hdmi_init(struct drm_device *dev, struct i2c_adapter *ddc, unsigned long supported_formats, unsigned int max_bpc); +int drm_connector_hdmi_setup(struct drm_connector *connector, + const char *vendor, const char *product, + const struct drm_connector_hdmi_funcs *hdmi_funcs, + unsigned long supported_formats, + unsigned int max_bpc); void drm_connector_attach_edid_property(struct drm_connector *connector); int drm_connector_register(struct drm_connector *connector); void drm_connector_unregister(struct drm_connector *connector); From patchwork Thu Mar 7 23:57:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 778544 Received: from mail-lj1-f175.google.com (mail-lj1-f175.google.com [209.85.208.175]) (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 4A12945031 for ; Thu, 7 Mar 2024 23:57:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.175 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855831; cv=none; b=Inrv2Bn40ogd7gQq7vBNgM2j10v4wbAVSyJ0WD/Uzu/AKwhmAh1GIdxvGtYdB4GejWnNJOjCWkkjZrzxQ9zJ75sS4Tj30Wk7JUNPoHdgI9IS69ddqS/IaIICCGz7oY7L+k99HAVlrNSihoSDn2z+YqxM+WWAOongrZcnWelQfqY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855831; c=relaxed/simple; bh=+x1kUIee7AVt4kqlCisaJEmSVhGtSnW63wlN0WYeMiA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=toL7axcMlOoW5fweR6iA2ACN946z/8BqTft7hvq48avpXfqJc1qm7fvaTN5ZCAroNsHJdlkFl4VBamOC1/h+59xvR7KbzOcrSvsCaVb5WCjm//Ix0i5M3XIrv3uezShZm3jk4ZCAdibVILzJq+RTGVXrLhZgAa9WiyoL+QlR6/Y= 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=yCzZ/7tP; arc=none smtp.client-ip=209.85.208.175 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="yCzZ/7tP" Received: by mail-lj1-f175.google.com with SMTP id 38308e7fff4ca-2d220e39907so21159941fa.1 for ; Thu, 07 Mar 2024 15:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855827; x=1710460627; 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=u4g0A2mJqMdnp6Ni8UfsRj9520wAhqMQ6QMy2JhUnOU=; b=yCzZ/7tP1qGApnH7Bzdg5L1x4EIoYvlltxPJDBbfAbre4DdJwX9TpqkgkrKWEYDvIH WQbqu09QpxuYMwSMbULX4fcx5UXjFJ9mU6XDCVX3eWfnQ/PQBz9jV8CF8ChEOvEoeprl /lf/rcP7gn8jjqiSWJr8JBsZsDgcmSN7zivKEaBZg5BwNQSYDrKpguoEQX6wgzD9HYsX NJTJBWLBfjCM4rH/FyX4UmEbonFCnfXSpwiY/1So+byMemRNSynU/kl8J7c3z4hUIEMo WIHPBJ25rScaOrl4WGGa7MdvedOO+AWQcGV2ugyrqJujzeA9rYSwjpJVZPJocAY7ibdi R0cw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855827; x=1710460627; 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=u4g0A2mJqMdnp6Ni8UfsRj9520wAhqMQ6QMy2JhUnOU=; b=ArhbLKKrLMAVFeqXc4F2rFZiSVjO0mMG7pI6A8V0T89XkEiQHhKKrWjAHGNuDn2+ox dw09YAbXOv+ZEnne2GjsHFeOnYj+ClnOXEX0dzascluVK+kC6hyG75EJqx2d1aBkhuRr ltWH2FNc/WiW0K9muV1TrNeIQY9z9yOgFhaxpxwj6bzfoGLepSV2nR+pI/3RzvwJM5AS pn0XMtMDdyDvU6/2B/onHrKS7qOIgO4yq8ET8m7vSr42BeDZksTSPZwgjkftoDJ1KEl6 uVk++mk+dCLTNG6XN8UNPKew+SWMfCovfxnexd8kc5b5jRC4D4KkeoL0yUouKg8FPljC jATA== X-Forwarded-Encrypted: i=1; AJvYcCWGcvMyAb1nbH2CG8i0DEfcD8i2xRKNn4yosawRPEAHLab/MHHA/K/DFfYZ7873nMRkZpUfmJTQtTHaY9lxKmwU9D96iyjbjrn/ttseUw== X-Gm-Message-State: AOJu0YyYEvzZ3SijAHBEXQyVBiNQsYncpVRbKF6gsDANZh9BG4R1sBuK 6DjJua3t3JmaDl/27ev5EKV06mD9frWL+r5siEMzasBo2GjfDlrJy6kZJrUQLas= X-Google-Smtp-Source: AGHT+IHnzbTF0XaaPfXPOV+dLSi0h6C3uhHFgoDuYO0jtbmQe2VfAWhicaYbI6f6ZjHFWwvICqMuWw== X-Received: by 2002:ac2:46ec:0:b0:513:6bbc:e6fc with SMTP id q12-20020ac246ec000000b005136bbce6fcmr2641998lfo.8.1709855827608; Thu, 07 Mar 2024 15:57:07 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:06 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:03 +0200 Subject: [PATCH RFC 4/6] drm/connector: hdmi: add opaque data type Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-4-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=833; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+x1kUIee7AVt4kqlCisaJEmSVhGtSnW63wlN0WYeMiA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lRO/psOtZsryGYjtaY69ZDmy/fmZxGSuALo0 MH0TenaSr2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTgAKCRCLPIo+Aiko 1bWyB/96ELkZShJQsyKTOUoy9ypVBKSLltVC9CyfncZFcfJC5shSifparvQ4Le8sgjJoD/2QMc8 fJpSUEKjwVONTpTnUczcZCGSb+AD8Ananr14DMJk1qLgqdgEhQld80cwc4Nx4Ymh/2sfKh08eB6 7Zo9MNIsAMrsQHpC8/fnISo1aw9DbUNEQe/dAnV0FKrGaiGef+PHa9+9PR9fDisGNy/NiZXr5ol 9RbTzIFxaH/I6bE7NEYh/phl13xjQQY/cz+tdarJWMzvngg8zdEbe9T97fixyJEwK0hdRL3AbIb YHRRNAze8OMlT1H0Jrg6D3cFUfw0hp3CdmavESs3McL2O0qE X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A HDMI bridge drivers need to store private data pointer to be used from drm_connector_hdmi_funcs::write_infoframes() and clear_infoframes() callbacks. Add it to the drm_connector.hdmi structure. Signed-off-by: Dmitry Baryshkov --- include/drm/drm_connector.h | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/include/drm/drm_connector.h b/include/drm/drm_connector.h index 37d54d5ff0d6..d5c240ad7c5f 100644 --- a/include/drm/drm_connector.h +++ b/include/drm/drm_connector.h @@ -2088,6 +2088,11 @@ struct drm_connector { */ const struct drm_connector_hdmi_funcs *funcs; + /** + * @data: Internal data pointer used by the HDMI connector funcs. + */ + void *data; + /** * @infoframes: Current Infoframes output by the connector */ From patchwork Thu Mar 7 23:57: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: 778894 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 1836A1D698 for ; Thu, 7 Mar 2024 23:57:09 +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=1709855831; cv=none; b=KmDuFcIen6JXy0Fgxhk+qDcPYtNQKtK7+lizre5PNUZiJDrAcZhCqKbam3zOr00FQpQpVijBMZ6bNX+pTotOlBl/6PfVA2iGYmQoK84FS8dIBJZt1/VsJa96YwY1zqA3GU+DcoD3Oh47kN3tkxgh0lDIng04e5BPF1mPtmNkT20= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855831; c=relaxed/simple; bh=BLTMrmfRiYz+a4tS74ezbT2hZO40I+AiAHfNW/m4HPQ=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=HPNKA+n24BTTBV+eh5mfvBOLiTFPohjKMSc5Qo1bPpN49Z+WYT37MgGW7wBeCwRZsfYVhR3Y7FpaFIcpSSWsIt1YWGN3woL5uXUrC32y9K8S7dViFML7tcIdv/I1Ol9BUZYPNN6W0iHTYc17sUZtmh1CjgTbCeo2BGqlKS92R6s= 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=jiEhmlfS; 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="jiEhmlfS" Received: by mail-lf1-f46.google.com with SMTP id 2adb3069b0e04-513382f40e9so1819608e87.2 for ; Thu, 07 Mar 2024 15:57:09 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855828; x=1710460628; 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=oSCLgDYohNznRCwnS8tfo5EB4gMkp+kuVZWS1xIx1Q0=; b=jiEhmlfSzOEaAKtw7A4DUwIfWvrOT0Vsvy1hAISY5jzYd8RsdOEMRj1UTnQimwgCjE CoyKtMQh2xmaVtqXzg7Y6DcTc95gPZGiKME0fb8uYgW1eGEZdJt+WXrTd3tk5hwKe80m 6S8PHpnjBBfBC8aanmEgu7r0jJEFlH5CNMy6Cu3f/kTI4M5gN/3ZvxAQXufyQQP+MZRH tnmPZ0Dgc0XlopbxdLf9Hk5mdfEpOBcHk+CJUBb4bv/yy9top/5LYxHSqJx/YX3gyXbW 5+GDRx76E5mIP5MRJNFqctuU7zlG6qI0htxygLEeLjp/z9zgvSTg1zWYJ4AJW7vC3NEs b0/w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855828; x=1710460628; 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=oSCLgDYohNznRCwnS8tfo5EB4gMkp+kuVZWS1xIx1Q0=; b=k96t5I2CIG/LYv0rRuNbPWtVgOkxtqVUPoiTrmgeKyMWDHuXwHQOAwkBGd9NYj9vhl u7LCOcI6nVtwUpLkqbED/jPtSthBNohy5kKWZZt1AqLmJB8qbjJ5hqZhAxrYtMHsUakc By55bwl8N4l8RqS91TfgGIGqpoNS9qcpT7Gtw1AzL78AatZm1g2+WSQ42L3hs6jRzF8J ngeuK1u6ZG49t0nHkkTCLVYRmES/p+ahs54BBUGEJMfwOQTKnhnXmYAkCbRwOXcbkFex l953JzW6IPTdw319T9dBqnkFvKelhkK8rD/MSvWNFwsiX3lS8s7Y+xRiV62LZm6uVsiK gJcg== X-Forwarded-Encrypted: i=1; AJvYcCWjmbckr5ae56U9Hxf8DhT6DEdkc4FUXD94sHLOhmHmfVqqKB/T8KqiSidARUPAHYNqhLgC0K4c3n3ySIEwMmeeWlnkxqh1jlRNQ56ZWQ== X-Gm-Message-State: AOJu0YxqPkOG/a3+K1cVfu3FKIB2OYt7xOhBfGyBueEibSkr9p3IMo9T uhilwK/pO3Pbq82sbRhumyclwyAFlA+WXBGzfzQ91CcUaqLCH3h5uSecoq4Dx3A= X-Google-Smtp-Source: AGHT+IEx8ik/HnzE5BA3s5swGV9Uvxj+BG3KC6Xb175mtXkrd/DFHNiOAucs1EnWSDmhAsJ/EiGyZw== X-Received: by 2002:a05:6512:4892:b0:513:5c68:9891 with SMTP id eq18-20020a056512489200b005135c689891mr2272468lfb.44.1709855828422; Thu, 07 Mar 2024 15:57:08 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:07 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:04 +0200 Subject: [PATCH RFC 5/6] drm/msm/hdmi: switch to atomic bridge callbacks Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-5-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2124; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=BLTMrmfRiYz+a4tS74ezbT2hZO40I+AiAHfNW/m4HPQ=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lROL7TvShNhOkfkCagc8FA+VRYozrsB3Q7UA zETQDg5gr6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTgAKCRCLPIo+Aiko 1fQ2B/0ZYDxsY+2fnjYDrke5sXxwtAYhbmqca/jy6/PZd9RLE6EoGmw3UjQ9+BkB/3DLashehFZ A4QKe+48Hk9UC7q75UmY+fdFTK6F11Eq39JoHum+VnA3YhBDT1mUzcrCGWIdsMjbJ8nLIVcfqil y1VzRByOEZt8L86tJGG5ppOv6t+WYsckKA4MxZyxTF7SndcMQDhg576pSae+f7N1pyG1PueyVbr P2/+Grv0/xoB9mpaw9Je3rsMWWCZt32xe3Nr9e7dSnD7Un/uYJC8WdKxnX8cBBZTqjexmmTbCWH /yuLJCdw7GPswznIkLI11B7SVfk/5qBFhqIZQU9dfudhZEHF X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Change MSM HDMI bridge to use atomic_* callbacks in preparation to enablign the HDMI connector support. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 4a5b5112227f..d839c71091dc 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -126,7 +126,8 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi) hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val); } -static void msm_hdmi_bridge_pre_enable(struct drm_bridge *bridge) +static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; @@ -152,7 +153,8 @@ static void msm_hdmi_bridge_pre_enable(struct drm_bridge *bridge) msm_hdmi_hdcp_on(hdmi->hdcp_ctrl); } -static void msm_hdmi_bridge_post_disable(struct drm_bridge *bridge) +static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; @@ -299,8 +301,11 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge } static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { - .pre_enable = msm_hdmi_bridge_pre_enable, - .post_disable = msm_hdmi_bridge_post_disable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_pre_enable = msm_hdmi_bridge_atomic_pre_enable, + .atomic_post_disable = msm_hdmi_bridge_atomic_post_disable, .mode_set = msm_hdmi_bridge_mode_set, .mode_valid = msm_hdmi_bridge_mode_valid, .edid_read = msm_hdmi_bridge_edid_read, From patchwork Thu Mar 7 23:57:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 778543 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 3635A4879B for ; Thu, 7 Mar 2024 23:57:11 +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=1709855833; cv=none; b=SGBNQ68uvnuO3EC95zPGD66g61njLWv++XNQpA7ZeVJFLaCVgHDBHbqjF4tWwACLBMspcaLYQGaqvrRViTEK9WBhgRURwE5ZSUaJfAB/xO56YUuPP29mppn5if6hcemPWH/ISF+06ovS4YW1QHtU1zR6XwQkvriphyZeoX/7M+4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709855833; c=relaxed/simple; bh=TXYWz2o+G56/mfXWFApDQcaAJZo0tKkXqhChihztQJA=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=aPJNsMhD6VGky8wfzDZDCNhwZikPQyrJpWeyW3xrqSIX0B6QfjcCsweX9vUNrQ/mcKypUlghzRdx+3XLSKzhCH/F9+sbbiCbNBVrQC4dv6SsMPy6dju61slvWF6tdUwcSWU6EqIuai20BvOM+rHwznDCO7pAOEtoOeh01KrNjNk= 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=iboTbB2Y; 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="iboTbB2Y" Received: by mail-lf1-f44.google.com with SMTP id 2adb3069b0e04-51321e71673so1625835e87.2 for ; Thu, 07 Mar 2024 15:57:10 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1709855829; x=1710460629; 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=GK5XNOVT37zheDhBlvzH4xXIpFb1sao65Rig8QVMcBw=; b=iboTbB2YrCiv9gt0SP/UKch65H1uana2vJGNLTuAXuPpF+p468BjsoOB7yv785FTe/ //MYxq0AJcfYVgBVPUsTh2R8L2tVSoFQB7MyQkZzeH8LRcnX+2iNfTej1S3ksrXH3E22 jMPpyHWnvwHU8k0MMvhwIEDbBOogjfYSnHSBGoFvE6QQuVMW2Tmn34rhRP8sLoumIzZg YDEdqwaS6uHEJsI5QldzfmupKSywMOHh/rGGcJRTAPxQLt4vY0684FngaLT673psBuv1 ELTTLltX2dV7b+g4WwliJMUyjAvqnU5ALG1UJ0pWAn5NExi5nCKbmQfYXsPh9JHoDYp5 OWKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709855829; x=1710460629; 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=GK5XNOVT37zheDhBlvzH4xXIpFb1sao65Rig8QVMcBw=; b=figeSwbUDU4figPL2PGCEY+V4zLS2x7P+Mq/V5PPvIGUnhyCuWU0XeR0m0y5tXABil QmEzjEZn1h8D2ZfUPbyJrJ3RhZa52DnQ3B2UGXOAVD5zJuYt6Qlg3GN7Iq0LJ98Yjwkr VRNaOGism5aFWFfRKLvRAGKvq817ddGI6emWHzur8lB0Chz8uvxDQG16Ssns8nkI2Hyf YGLbHCExfY7ZenN6ha030f/uYxbH9l0Oxx/BeyVwtcckzr3jF07T9rwUMSdDHvXK2mUv q/FuPjTwMQ8i4BvVmAY8ebEhDxbp5i69cjICNUVrMYYbUzIGlBL8tl6nXqaJdmi+XstW YlGw== X-Forwarded-Encrypted: i=1; AJvYcCWkX7X7+h/nxfzO82NYk0ULhBlQBYWdcADliWIDtth4Y6j18tq/eDtbRRx5ggPv/O/ux54mLpsdWcHrVGaut0JMPiOuvHweoQHIYj5VoQ== X-Gm-Message-State: AOJu0YzJy4gK9pM9n3ILUYugUJF2Rxo+/cocWnqNAIps0jlsh+z8m9uU xqMPHYBPI1r+kYla1IPRUrCqnjYDBWOudWmQnrFCfNwYHP5akt4BRnmN3FPXruA= X-Google-Smtp-Source: AGHT+IHzMD7PYqcuhD/abvrL6OPdgwt61AHHLj9TptIR9Ky1X4VlQud7DglQwVyw/LxB+27EURXdhg== X-Received: by 2002:a05:6512:2118:b0:513:7e6a:ecfb with SMTP id q24-20020a056512211800b005137e6aecfbmr2127866lfr.65.1709855829217; Thu, 07 Mar 2024 15:57:09 -0800 (PST) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id c25-20020ac25f79000000b005133277eb29sm2796475lfc.270.2024.03.07.15.57.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 07 Mar 2024 15:57:08 -0800 (PST) From: Dmitry Baryshkov Date: Fri, 08 Mar 2024 01:57:05 +0200 Subject: [PATCH RFC 6/6] drm/msm/hdmi: make use of the drm_connector_hdmi framework Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240308-bridge-hdmi-connector-v1-6-90b693550260@linaro.org> References: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> In-Reply-To: <20240308-bridge-hdmi-connector-v1-0-90b693550260@linaro.org> To: Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , David Airlie , Daniel Vetter , Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten Cc: dri-devel@lists.freedesktop.org, linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=6259; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=TXYWz2o+G56/mfXWFApDQcaAJZo0tKkXqhChihztQJA=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBl6lRODQf/UkaVtuTdFcqJY0cBtJwnVmB4bQh4p bjEk3SI2iyJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZepUTgAKCRCLPIo+Aiko 1Yv/CAChblAPRULvIJO+Y0ZNMTE5sXE5ycGqq/4aWMWVvZ+Yw+ffNtkFyDQIbZVf8cG0RE5eQUU Z9H5bP7/c5wKF+d/s6e5IH5+/2I7SLcNrTkLVKpXvWs7ksyPcOR4R81p3ML2FmlazzUGeiXbpik byji7EYEF/7dXuQR7eySpVMi5GjnpD8XN1QfqMGdy/6FKgpiCstrP2Raw1Pfq+QDiT5eDt3ebvh QYpe1ex2bbEgTAXtQkI7l4bgYJGoJ8RJYm8MgSi/q6wjFRNG3kBmwrx41qWy5Gw+sxcDZ5GU/C6 VSUYjwvRb/HQzloPko0tOxTIYEpaA6LL+OdsjrIw/Slq7tJL X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Setup the HDMI connector on the MSM HDMI outputs. Make use of atomic_check hook and of the provided Infoframe infrastructure. Note: for now only AVI Infoframes are enabled. Audio Infoframes are currenly handled separately. This will be fixed for the final version. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 107 ++++++++++++++++++++++++++++----- 1 file changed, 91 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index d839c71091dc..ac42574db8f7 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -68,23 +68,15 @@ static void power_off(struct drm_bridge *bridge) #define AVI_IFRAME_LINE_NUMBER 1 -static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi) +static int msm_hdmi_config_avi_infoframe(struct hdmi *hdmi, + const u8 *buffer, size_t len) { - struct drm_crtc *crtc = hdmi->encoder->crtc; - const struct drm_display_mode *mode = &crtc->state->adjusted_mode; - union hdmi_infoframe frame; - u8 buffer[HDMI_INFOFRAME_SIZE(AVI)]; u32 val; - int len; - drm_hdmi_avi_infoframe_from_display_mode(&frame.avi, - hdmi->connector, mode); - - len = hdmi_infoframe_pack(&frame, buffer, sizeof(buffer)); - if (len < 0) { + if (len != HDMI_INFOFRAME_SIZE(AVI)) { DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to configure avi infoframe\n"); - return; + return -EINVAL; } /* @@ -124,6 +116,55 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi) val &= ~HDMI_INFOFRAME_CTRL1_AVI_INFO_LINE__MASK; val |= HDMI_INFOFRAME_CTRL1_AVI_INFO_LINE(AVI_IFRAME_LINE_NUMBER); hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val); + + return 0; +} + +static int msm_hdmi_bridge_clear_infoframe(struct drm_connector *connector, + enum hdmi_infoframe_type type) +{ + struct hdmi_bridge *hdmi_bridge = connector->hdmi.data; + struct hdmi *hdmi = hdmi_bridge->hdmi; + u32 val; + + val = hdmi_read(REG_HDMI_INFOFRAME_CTRL0); + + switch (type) { + case HDMI_INFOFRAME_TYPE_AVI: + val &= ~(HDMI_INFOFRAME_CTRL0_AVI_SEND | + HDMI_INFOFRAME_CTRL0_AVI_CONT); + break; + case HDMI_INFOFRAME_TYPE_AUDIO: + val &= ~(HDMI_INFOFRAME_CTRL0_AUDIO_SEND | + HDMI_INFOFRAME_CTRL0_AUDIO_CONT | + HDMI_INFOFRAME_CTRL0_AUDIO_INFO_SOURCE | + HDMI_INFOFRAME_CTRL0_AUDIO_INFO_UPDATE); + break; + default: + drm_dbg_driver(hdmi_bridge->base.dev, "Unsupported infoframe type %x\n", type); + } + + hdmi_write(REG_HDMI_INFOFRAME_CTRL0, val); + + return 0; +} + +static int msm_hdmi_bridge_write_infoframe(struct drm_connector *connector, + enum hdmi_infoframe_type type, + const u8 *buffer, size_t len) +{ + struct hdmi_bridge *hdmi_bridge = connector->hdmi.data; + struct hdmi *hdmi = hdmi_bridge->hdmi; + + msm_hdmi_bridge_clear_infoframe(connector, type); + + switch (type) { + case HDMI_INFOFRAME_TYPE_AVI: + return msm_hdmi_config_avi_infoframe(hdmi, buffer, len); + default: + drm_dbg_driver(hdmi_bridge->base.dev, "Unsupported infoframe type %x\n", type); + return 0; + } } static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, @@ -132,6 +173,10 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; struct hdmi_phy *phy = hdmi->phy; + struct drm_encoder *encoder = bridge->encoder; + struct drm_atomic_state *state = old_bridge_state->base.state; + struct drm_connector *connector = + drm_atomic_get_new_connector_for_encoder(state, encoder); DBG("power up"); @@ -139,12 +184,13 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, msm_hdmi_phy_resource_enable(phy); msm_hdmi_power_on(bridge); hdmi->power_on = true; - if (hdmi->hdmi_mode) { - msm_hdmi_config_avi_infoframe(hdmi); - msm_hdmi_audio_update(hdmi); - } } + drm_atomic_helper_connector_hdmi_update_infoframes(connector, state); + + if (hdmi->hdmi_mode) + msm_hdmi_audio_update(hdmi); + msm_hdmi_phy_powerup(phy, hdmi->pixclock); msm_hdmi_set_mode(hdmi, true); @@ -177,6 +223,15 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, } } +static int msm_hdmi_bridge_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + return drm_atomic_helper_connector_hdmi_check(conn_state->connector, + conn_state->state); +} + static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -300,16 +355,36 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge return 0; } +static const struct drm_connector_hdmi_funcs msm_hdmi_bridge_hdmi_funcs = { + .clear_infoframe = msm_hdmi_bridge_clear_infoframe, + .write_infoframe = msm_hdmi_bridge_write_infoframe, +}; + +static int msm_hdmi_bridge_setup_connector(struct drm_bridge *bridge, + struct drm_connector *connector) +{ + if (connector->hdmi.data) + return -EBUSY; + + connector->hdmi.data = to_hdmi_bridge(bridge); + + return drm_connector_hdmi_setup(connector, "Qualcomm", "Snapdragon", + &msm_hdmi_bridge_hdmi_funcs, + BIT(HDMI_COLORSPACE_RGB), 8); +} + static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_check = msm_hdmi_bridge_atomic_check, .atomic_pre_enable = msm_hdmi_bridge_atomic_pre_enable, .atomic_post_disable = msm_hdmi_bridge_atomic_post_disable, .mode_set = msm_hdmi_bridge_mode_set, .mode_valid = msm_hdmi_bridge_mode_valid, .edid_read = msm_hdmi_bridge_edid_read, .detect = msm_hdmi_bridge_detect, + .setup_connector = msm_hdmi_bridge_setup_connector, }; static void