From patchwork Fri May 31 20:07:28 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13682112 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 2D7CDC27C4F for ; Fri, 31 May 2024 20:08:08 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DF5C410E420; Fri, 31 May 2024 20:08:03 +0000 (UTC) Authentication-Results: gabe.freedesktop.org; dkim=pass (2048-bit key; unprotected) header.d=linaro.org header.i=@linaro.org header.b="t+RpHYm/"; dkim-atps=neutral Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) by gabe.freedesktop.org (Postfix) with ESMTPS id D0E2B10E148 for ; Fri, 31 May 2024 20:07:36 +0000 (UTC) Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2e724bc466fso27534011fa.3 for ; Fri, 31 May 2024 13:07:36 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1717186055; x=1717790855; darn=lists.freedesktop.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=FiLWZR73FzG1cBUuGAjbn5LfyouiORitTo/38HE0+Xs=; b=t+RpHYm/KA4tyH3417qmH/9t273J3+Yeb93dRNXJt8jbiHk6DAni6CjLEGxov/3IMr EgfdDVjo1brMHPqIVD6FS8iHnGCgRqQASc2wIBawNJ1PpkQsvkrw/W6+doszm2SVJLYo NZgUiChGkBWUC8Qip3qf0XbFAzTpMX7mdNfEveI+i/iup38XlGef5e2UWcuLTKfvcs/0 D1CTyNBPmF0mDyPUO6OlzBshOrFZ3wqtX7sBozsJzFE5WlSgIxv+wjEOKKSGI4DaOCuA MspWjEM5OcY6BNo54VySf+TraxdEY+I5HywKsKWTqFG30InqhDutRowfxXAJqOR1/1cO SGCw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1717186055; x=1717790855; 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=FiLWZR73FzG1cBUuGAjbn5LfyouiORitTo/38HE0+Xs=; b=qSr+awNjh2Qe523lhwU+uopQC3aKwlVMjjFzvZHB0xGdoqgq/p66d07sda++a+I8pZ fBjlK+zODi/Azqku/KcskzQBmQiokVxjqgVv+UNwJVC1qj5BMT02SZKOqiLzJUtyycgB +0t+u+MuN59onn2mIbyOZm+slVlWZBub2oIcrppaBn26slHhpz9OGanV4sGRkDOjpDRA FMQvvpExVHEeXDWNA6Y+O4/IL1U1B2A0xIFPDI9eiCoN22xz/3Igj4vxbbZTnT7YusEY U096/61sumFsZqUSe7gEz/lWP3Mu2e82oTcRpWQUc5h3qYJCZaGfkPINDSBbl5BeOSgE /oqA== X-Gm-Message-State: AOJu0YwfImd2OUA4EO3cGhvk/JQJEFiww6fs06p3O0XukBsFnfAUdxtm ettzRFo81UzPfh9j0S21A0N7aMPTlDcaa9KYZ6RjRtzwUh2isH9mTsAv04jT3GE= X-Google-Smtp-Source: AGHT+IGV3cCszJL2Evl8iyDXheyiC6hOTx+o95E4nNadmsnYln85PmjclchsS6VnyRMmAvINPl2LPw== X-Received: by 2002:a2e:b693:0:b0:2e9:8852:3d20 with SMTP id 38308e7fff4ca-2ea951e4c52mr23923571fa.41.1717186054220; Fri, 31 May 2024 13:07:34 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ea91cf0b83sm4022111fa.116.2024.05.31.13.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 31 May 2024 13:07:33 -0700 (PDT) From: Dmitry Baryshkov Date: Fri, 31 May 2024 23:07:28 +0300 Subject: [PATCH v4 5/9] drm/msm/hdmi: turn mode_set into atomic_enable MIME-Version: 1.0 Message-Id: <20240531-bridge-hdmi-connector-v4-5-5110f7943622@linaro.org> References: <20240531-bridge-hdmi-connector-v4-0-5110f7943622@linaro.org> In-Reply-To: <20240531-bridge-hdmi-connector-v4-0-5110f7943622@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, linux-kernel@vger.kernel.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3487; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=UWUILZSKKGNyx193zjImsEEpRTHfS6fkYYigZ43zbQc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmWi4A5VAxSNzIvkri0KCvCvKC+3PtYIkHbBwQf Y+oSMDUI96JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZlouAAAKCRCLPIo+Aiko 1W3/B/9hxuzoStd2MFOr27dsWDaQLvdDfDKq6OitbAFUenCZ+yoDz5INHgYLgNAFKeLcQY97zk7 oi/xQrziuDyC8cYUzfBovdERtp6AbdklpswZ+qzOXYDBDmE62EDkfOTTf4JLYKS/Gmkny+96+6J uWPoLmdWkj7jT1ndF3RNxt4hE+HU/PkBp8A8s67dkotwqviDsyUpG7UqzVZflZ2cvMNMXkdTgsN SVneGeLuMUXeDLryp0nZwyspdFGdySGkKqSAlQisz1ZQf6X2NBbgeDg4Nob6bvmCn8s0w2bV2zE AKSxqnDsWh1Dk0Bzlfe9s+lWijwVpfzA0OPpeBulpM9dheKA X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The mode_set callback is deprecated, it doesn't get the drm_bridge_state, just mode-related argumetns. Turn it into the atomic_enable callback as suggested by the documentation. Signed-off-by: Dmitry Baryshkov Acked-by: Maxime Ripard --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 33 ++++++++++++++++++++++++++------- 1 file changed, 26 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index d839c71091dc..f259d6268c0f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -129,12 +129,25 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi) static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { + struct drm_atomic_state *state = old_bridge_state->base.state; 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_connector *connector; + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + const struct drm_display_mode *mode; DBG("power up"); + connector = drm_atomic_get_new_connector_for_encoder(state, encoder); + conn_state = drm_atomic_get_new_connector_state(state, connector); + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; + + hdmi->pixclock = mode->clock * 1000; + if (!hdmi->power_on) { msm_hdmi_phy_resource_enable(phy); msm_hdmi_power_on(bridge); @@ -177,18 +190,24 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, } } -static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge, - const struct drm_display_mode *mode, - const struct drm_display_mode *adjusted_mode) +static void msm_hdmi_bridge_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { + struct drm_atomic_state *state = old_bridge_state->base.state; struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; + struct drm_encoder *encoder = bridge->encoder; + struct drm_connector *connector; + struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; + const struct drm_display_mode *mode; int hstart, hend, vstart, vend; uint32_t frame_ctrl; - mode = adjusted_mode; - - hdmi->pixclock = mode->clock * 1000; + connector = drm_atomic_get_new_connector_for_encoder(state, encoder); + conn_state = drm_atomic_get_new_connector_state(state, connector); + crtc_state = drm_atomic_get_new_crtc_state(state, conn_state->crtc); + mode = &crtc_state->adjusted_mode; hstart = mode->htotal - mode->hsync_start; hend = mode->htotal - mode->hsync_start + mode->hdisplay; @@ -305,8 +324,8 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { .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_enable = msm_hdmi_bridge_atomic_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,