From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 7145A5EE80 for ; Sat, 22 Jun 2024 22:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093743; cv=none; b=YMtG148r8/XWCTW9V0MmwgAekkJQ+7IXbuQwiRiFSnydhCBIaAXtkS3Jzrmr3aO20WUP3tJYsKeAhI1kZtayNL4cqN0sY5cL1L02rAgspy655YRytMmuCyxrwWuToiaHveoTNcTcl+dshx+GgKVfYReBebtP6/90fxAtLPREC7A= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093743; c=relaxed/simple; bh=QHJFLuLUkbw1F9+Kq0qmn518QlvE7rv63CWK8Jlxpns=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=GBWpugOutf7L/DYEx/A0GtHU904WxeumAWEBAmQBYGOGXwZlidPaR+cLZ39Ycl5UJbM+vmp6RyzP1lMLeArlDEsbNGVtDCrml/PLfuX6opsDGskmMpbXAbEfBki3AdTue+KKbQo4RQ18LRPm4Y0BBYWsu9sbFVWvjQLbpoxq0rY= 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=E8Q5CXaJ; arc=none smtp.client-ip=209.85.208.174 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="E8Q5CXaJ" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2ebe3fb5d4dso27515961fa.0 for ; Sat, 22 Jun 2024 15:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093739; x=1719698539; 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=0wEX4Yto30IpkmFMs/2PNdUGRMDgLHDuNenxP6Onffw=; b=E8Q5CXaJjS+hTFC6uhfz9WKW79I0UtqOh/7J9uI0BoC3nCZaWfdXi5l11k4iJ8vaXX C1UGIDDpyv1OwfndVGaZ8GTh9YtXrUvFc8IM2hXNbcSIx+N+40YCTeHyz9G/7DJILjZu jiEVXcCxGiJdvfdXr6CRD/62SL9CBEQ1diigDq79Ar+XE1TT+ag6/hA/g1918AnzpLvU C6ba1g3WOYgpwiEi/jJWgrm14OJsTAw0AeZxl6yx9BIv2x3A/G3wvmQ+G2V/ixIfNqSm eZc9sp+XhOQbWRJI4Zclfs0aVUVvufMMeOVTYcHisA3TLx0ud0w8kuBg5jtaANwcsTqv dauQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093739; x=1719698539; 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=0wEX4Yto30IpkmFMs/2PNdUGRMDgLHDuNenxP6Onffw=; b=McqLmKCMvxZb0IBktGTY2vvR4ofNAwfS+BkypaPhWoO33fi+0xG5iJKaViwKumAOwR 7rdU7RyjSxds/4QCH3QpLQFaYvdOIwpz2BBekCyY/bY/UY30oVzr3txZXcf1mipFz/4I osSL2MJvwBkU4cSYb84s3ldMCgNCkg2n+g5TOyyRPcvSLKzHjW8HVzUuxi3n7EGnVvjL sS0cHnc5czhy45pQqJIBn00zS94cvzNaUk8zjM2/J94zk5eDL20SeiSma5LGOD/Sz7aL XQ2U/XyI9cTViq17ltfWejGBK07Ko6RXuTZ1t4I3IulCOkY5IaeGGz+sWxJuw09HDKxH CnQQ== X-Forwarded-Encrypted: i=1; AJvYcCWmbvMUPpRplWhH0LIOYTfK0vOf7V0cbIVeqNu0UMga1rM3n7QbWS6lDl80OBIU4arNBiLzDgf4PeAPgO04acJY5knUmo9WMdVrI6db X-Gm-Message-State: AOJu0YxsIJm5CQtQqVaAHYTYWO8khfE1/UipAOZoOyEl+d8pyBX/rL72 BzZ+LZGie5N8CbW6EsNbNyK8NNf0k7CRpJgRPygP1zlvW7Sem1g5Lun/upOc6rI= X-Google-Smtp-Source: AGHT+IEdI74CL0f7ufTLv8SMKdBOVwYB/E2BMf/MfUp1uHBXxRD0EMKOJuGq7/P8DqPrTwph+p61uQ== X-Received: by 2002:a2e:8789:0:b0:2eb:dc3d:cd00 with SMTP id 38308e7fff4ca-2ec56b8282emr5671941fa.14.1719093739578; Sat, 22 Jun 2024 15:02:19 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:19 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:14 +0300 Subject: [PATCH v3 01/13] drm/msm/hdmi: program HDMI timings during atomic_pre_enable 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: <20240623-fd-hdmi-hpd-v3-1-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3152; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=QHJFLuLUkbw1F9+Kq0qmn518QlvE7rv63CWK8Jlxpns=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1q554v+Ssamd1VLAyMOMNhyrcySWPbvFIc5v4yRa4l48 soYyUWdjMYsDIxcDLJiiiw+BS1TYzYlh33YMbUeZhArE8gUBi5OAZjIrxL2/7UVVbE7b/w81f3u 77TNokce+/1+ofbSdjPf3W7/Odwe3DkRLF+bb4s4/H6trJO8fr5CbieH+JMZ36QkZwUvOZPGO7/ kl2rAfz85sYNbopSSBRPD0ycLLJTS/dj/vjtC5FXQjOccrTLJmoIOC+ZHR9/pnh1WveaAu+m52X t+SfZX988v53DgnLzzz0S9aRXnRRIY9qdvVq2MjNp+2lhGp0OgVuDtg4T83tXf2PR1f6wsVnabp RWiZXXqT/C31y/e7Nt690OkrdXEs2ES37eWVp8q+vq83vSUyOal6W4P9R8EncxrX9ZfGjOXMX2Z 58O+PQ15dqwrHPO229w7kpGQy+QVPKOnxaU8VkOohNMIAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The mode_set callback is deprecated, it doesn't get the drm_bridge_state, just mode-related argumetns. Also Abhinav pointed out that HDMI timings should be programmed after setting up HDMI PHY and PLL. Rework the code to program HDMI timings at the end of atomic_pre_enable(). Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index 92c95b4bc1fa..438416eaf390 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -304,6 +304,8 @@ static int msm_hdmi_bridge_atomic_check(struct drm_brid= ge *bridge, return drm_atomic_helper_connector_hdmi_check(conn_state->connector, conn= _state->state); } =20 +static void msm_hdmi_bridge_atomic_set_timings(struct hdmi *hdmi, + const struct drm_display_mode *mode); static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { @@ -314,11 +316,13 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct = drm_bridge *bridge, struct drm_encoder *encoder =3D bridge->encoder; struct drm_connector *connector; struct drm_connector_state *conn_state; + struct drm_crtc_state *crtc_state; =20 DBG("power up"); =20 connector =3D drm_atomic_get_new_connector_for_encoder(state, encoder); conn_state =3D drm_atomic_get_new_connector_state(state, connector); + crtc_state =3D drm_atomic_get_new_crtc_state(state, conn_state->crtc); =20 hdmi->pixclock =3D conn_state->hdmi.tmds_char_rate; =20 @@ -336,6 +340,8 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct dr= m_bridge *bridge, =20 if (hdmi->hdcp_ctrl) msm_hdmi_hdcp_on(hdmi->hdcp_ctrl); + + msm_hdmi_bridge_atomic_set_timings(hdmi, &crtc_state->adjusted_mode); } =20 static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, @@ -360,17 +366,12 @@ static void msm_hdmi_bridge_atomic_post_disable(struc= t drm_bridge *bridge, } } =20 -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_set_timings(struct hdmi *hdmi, + const struct drm_display_mode *mode) { - struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); - struct hdmi *hdmi =3D hdmi_bridge->hdmi; int hstart, hend, vstart, vend; uint32_t frame_ctrl; =20 - mode =3D adjusted_mode; - hstart =3D mode->htotal - mode->hsync_start; hend =3D mode->htotal - mode->hsync_start + mode->hdisplay; =20 @@ -474,7 +475,6 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_fu= ncs =3D { .atomic_check =3D msm_hdmi_bridge_atomic_check, .atomic_pre_enable =3D msm_hdmi_bridge_atomic_pre_enable, .atomic_post_disable =3D msm_hdmi_bridge_atomic_post_disable, - .mode_set =3D msm_hdmi_bridge_mode_set, .mode_valid =3D msm_hdmi_bridge_mode_valid, .edid_read =3D msm_hdmi_bridge_edid_read, .detect =3D msm_hdmi_bridge_detect, --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 DA2B26DD08 for ; Sat, 22 Jun 2024 22:02:21 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093743; cv=none; b=Mk+AAu1OBft4jMQxdMlwpXxIWWiIZDLu+EGXy83j5zjpp4N6Oo9q78+fdho4m4koal/EYY1OCHp545UuDH3ovoQtcGe4mwpO1QxPXk0xywRooB+TkWu0gJi/u6jKaR2qzdNUAAtl6jqHIywjXz50+Sw2SpZIU61Waruj6R2s3Wg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093743; c=relaxed/simple; bh=h0lqf9slPd5eUxk6pPihIhSWYhdShDER4/lwQr5RwCE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BspAIggBAluEuTu+TLc/Ok/kW2gFQyWbapb7msJ0lz/hd2asdc8ktJwayrb9rcd/ZzJe5yjD10Bd8tABr3h6ASL8+uMw0u7VkuSAzOv7nTgI+D95fbCz79sqgTLnXxVR7c07Uy7F6VWCnzNGCBAcOb4BwGXfO95xVD59r4tjqN0= 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=CGiBKUyd; arc=none smtp.client-ip=209.85.208.181 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="CGiBKUyd" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ec50d4e46aso15444351fa.1 for ; Sat, 22 Jun 2024 15:02:21 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093740; x=1719698540; 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=PaaD0TUxicSQ9bcBzddmbploW93tWtfw/qjS+oWjoTA=; b=CGiBKUydMeXWqPLWpNGW0tW80g4XyuOuiHxWf2BC/IbSUKZHYl7nCt8DwuBDL7fwwr dbBMaLkV9Iate91Kk+HQ4JRrWuoehZqkA1VCdrai4tYjEravGXIfWhWP9zQrvmuXP1PP tMGwY4khF+FHGYY8UanHqdTmUUwbq3Lp51TnnU+UOY3sKJfrIRLZQ4xwvdGZIxX2DLAV 2YhPzZ44kEvr/SmkdpmOU58SzWERHjiqEuAL2kqES1hsDwueOof2IV0Kt+pFzYnMcv3o hmWgrCkHCxnKZUQ0/9GJtNSlMEC6L7JGm9n+tbycIIp22TV6FiFqDi0S/6C4My+S6WFx 1+Yg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093740; x=1719698540; 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=PaaD0TUxicSQ9bcBzddmbploW93tWtfw/qjS+oWjoTA=; b=QcwR6cHyMyNL59MqEh4mrLA2muodWAktudF5P7XCmBm9cuMYzNlOBbD1HMl4dqXYXX VUzLV8ISSrCYxaKv4Tuht+SlPh+0O1nd8EiIEswx68tih5fs0++Hzt+BexsbExVr8BYu seyGWmZR1Y3v4iNQKNxb/u//799IJ62jMg3Nh99VRJQC3fuoGWO5nst21MJ22HgHI3+q f7RN77pIsz8yZ5mQxxbUToUDZmwbWJ2VtVv1NhEldeLP2DMcHtrWaB2T7kLXjRjXsSen 2xy4UbaWdjRc1Pbt+Lqch3GvNGxTEpYzFpvYrH0YaC8jDLeqcK64QxzNYmq9yV5Kh0QO muVw== X-Forwarded-Encrypted: i=1; AJvYcCWGcmoLJTElVqdysivNOsAzuWnhR1KhZHc0uWRVyydpe+y/eficCo4fpGTvmu5aXI1A73fz8YwY6xL/Q+fCzUcVa2sL+mNqcYpzdDPp X-Gm-Message-State: AOJu0YwvKiSp5Yt3WmAeD3IGeD96JZWsOT35ucp8Sy00PQKB3WidWBYy NlfBk8P1V/em0P+YqTM68fi6h0yp+PCTEWUE+OkSEdupiDszKAwfBKueqakbR2c= X-Google-Smtp-Source: AGHT+IH31u6dzIAuNw0VNvPZ2GqCzxLoG78KUvKhD6XvPjNqmtALsT04SfRsx1ap83ri/b4wewW5YQ== X-Received: by 2002:a2e:3218:0:b0:2ec:5685:f06b with SMTP id 38308e7fff4ca-2ec579837bamr11068451fa.27.1719093740178; Sat, 22 Jun 2024 15:02:20 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:19 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:15 +0300 Subject: [PATCH v3 02/13] drm/msm/hdmi: move the alt_iface clock to the hpd list 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: <20240623-fd-hdmi-hpd-v3-2-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang , Konrad Dybcio X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1422; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=h0lqf9slPd5eUxk6pPihIhSWYhdShDER4/lwQr5RwCE=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1q554sXjVmrzHatz+7ke/5WkuGWZkd97RrOzMsB/A6ns nNcrB51MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAiK9LZ/5n5inesrmwVuLDO W6HR11dVtny2II/Ft7CzSpG3pHf7lNnZcXv/3CrsuaRUprmtUs3mJZdH7ZPIOSd577cYtqlJ7/r Id/7WpIVspzOPzOZb9rUugdtzLdOmtge6eR9OOjXw1nHp9OuxJCyb3fKWU1HOtWfa4RNGu6M22y fkMk+IYDd8sed83ILEhoKdV7kM3WeqqvakCP4523vvy+G3K3d0BDfu1Zwzz3rn8iPzDrY9SGedp JC73+ay5m7vuuU6vu9DZfKvs7X1qzwxYAsNvtt0Sij2TsvGbFPTPUvbN6orqR9Y1tDOccq3ceLq Ho0HaQv2myd1bNg5Kczjvs23789+NjA+Or3OeX25zlYTAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A According to the vendor kernel [1] , the alt_iface clock should be enabled together with the rest of HPD clocks, to make HPD to work properly. [1] https://git.codelinaro.org/clo/la/kernel/msm-3.18/-/commit/e07a5487e521= e57f76083c0a6e2f995414ac6d03 Reviewed-by: Jessica Zhang Reviewed-by: Konrad Dybcio Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 8c6c9dffffd6..818c66efdfed 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -234,9 +234,9 @@ static const struct hdmi_platform_config hdmi_tx_8960_c= onfig =3D { }; =20 static const char *pwr_reg_names_8x74[] =3D {"core-vdda", "core-vcc"}; -static const char *pwr_clk_names_8x74[] =3D {"extp", "alt_iface"}; -static const char *hpd_clk_names_8x74[] =3D {"iface", "core", "mdp_core"}; -static unsigned long hpd_clk_freq_8x74[] =3D {0, 19200000, 0}; +static const char *pwr_clk_names_8x74[] =3D {"extp"}; +static const char *hpd_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; +static unsigned long hpd_clk_freq_8x74[] =3D {0, 19200000, 0, 0}; =20 static const struct hdmi_platform_config hdmi_tx_8974_config =3D { HDMI_CFG(pwr_reg, 8x74), --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 AEA296F2F0 for ; Sat, 22 Jun 2024 22:02:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093744; cv=none; b=k6hEWLipjj459yXzW8q7DLComsHthklACAXG/mQHNsTT9RznIu1HKW0SUrZmsYKNbYK3iwiNI8tE79No3HxYfH+h9FPkAcMFaN6ONF+stBovr4+g0xyOmAvIT5IkMhd3Cj1sL7wFgRblzWml+GN0bfdJGDDmkZb5cnztM6WxYpw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093744; c=relaxed/simple; bh=3rPmiZo3dcY44pgbm6icOd9qL2vNRkCwi4ZPCN7/Yyk=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=BEPPWJ4klGilZ/rA952Nri1L2S2xDP/ewyYa9K8Ap/tdpJnIlc5YQooCvNlsCu0JRS3uxWMJY3wItf+OlYloh3b+dNBQ3/N/9lAXh6SJ1t/LkjQA0kQgSPwWEdqjE6/XPchdpeHmBG4rZJRi3t9TyyDxfEvdpB2jee+yE7A+3lY= 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=oT+BJZcC; arc=none smtp.client-ip=209.85.208.177 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="oT+BJZcC" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ebed33cb65so34374311fa.2 for ; Sat, 22 Jun 2024 15:02:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093741; x=1719698541; 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=aS9IkNI8BPD97NPqexkA01Wai+VXQfm008vsea+QEiM=; b=oT+BJZcCAMdanSeZN7e6/9PJnH7ja0E40LBSM4yunmVhfuWXlplsxmoE4uowmnLQc0 iXtBZAiWuUXrUwMvNMegG6fapnICrS6uWY6sdp2u62QV/pBYcjzRpm1CeFHedGDB/MUx XDhBfBltvBfdreDl/BFpYtfDzYvylOMZjo0t9zc47CfBUmhuu5gSk6ISd8TjcjOpWqrz Y7a632fcNzzUi6gEJ2YZb8XHRKd5M33ma5C1XPsyUy89jq7U7up0gpgw/p92P0e8O7tW aRzDpQJrFSeXBqtdCdH/Bw70iECBkZbPJ4LWy/45aRTc5oS6PbNCePv0ZnxIsz8VgRuP lvqg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093741; x=1719698541; 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=aS9IkNI8BPD97NPqexkA01Wai+VXQfm008vsea+QEiM=; b=Nu5qcOd5/QxzFepmW6kPrhp3R+9NjDLcfKuyLdbstOvFrLcicj7XVWBboR3duvSeE9 FIvM7afxFh1AHlK2pUEl3VPyniAJ48YAq0j5a+BIW6S8aXFTWp/Mcv2G3B9n5o+NgJ+C La2qIKm3i4Nu0TUh2Z3K3chdfl8qEakXjh0xLSXQiJYLpa9thiQznFQxX9QcJbEkp1XI rtjgx6PQ+60MawqGxLz8yibwICw2PCB74iUkb166oforqHxtI5dc2P3ykG9Ijn6q97bR r1zRDvWcgmqvTfCfbd7z7DNpZa+ZA6O8HIzgew537Rps7ir8FIaPLLDtA9UlNix8n932 oqIA== X-Forwarded-Encrypted: i=1; AJvYcCXpHG9e90l0rJ5kVLfyYjnfmkFgTpw9jSC74unn4nDTk8vvYKZToxEap2Tc7VYWQGbXj6zGC3J0PCsicbsBd+AC5hEdKWlGLd+u8bWf X-Gm-Message-State: AOJu0YyxmkVteASdSn7VI3MTOZ+k1wzBzRgyfMuyJQ27s1fOAvV5gZ2D 9ZF5RulKID7QKw8Hv9WQg/dtfKJ9G0seGqIZmJ5NLM00kyxV79cyqZlkDNbWsc0= X-Google-Smtp-Source: AGHT+IEgfa1HpfF6m2kYDL3wfOTgjMi1VWbHIPyepjtmTFGUtY5sTBUYisTDFiXR/n1/RVmxPJcq8g== X-Received: by 2002:a2e:9248:0:b0:2e9:8a0a:ea05 with SMTP id 38308e7fff4ca-2ec5931d897mr9308541fa.17.1719093740948; Sat, 22 Jun 2024 15:02:20 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:20 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:16 +0300 Subject: [PATCH v3 03/13] drm/msm/hdmi: simplify extp clock handling 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: <20240623-fd-hdmi-hpd-v3-3-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=5904; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=3rPmiZo3dcY44pgbm6icOd9qL2vNRkCwi4ZPCN7/Yyk=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0no/LAan1a1QvgJDC7bcBfgtLxqcmIMp+8Pe iCgwyrGmByJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6AAKCRCLPIo+Aiko 1du6B/9EZ/1JQFKgm9Y9w+gfmWdqjmz8mYUHOyo+0d7K9nDP5LY1VcUzt0PI3/2C+Wl3NJZHIZX U/Ou12SLin4kOxWVfkg2BuRe6fDSzMEdgavWatSmc37i1cicBevsV16NGjGZ3cRMBcIrhUlwivw DFYtS+l5EUcuJqC+iHsBuRbO4ikze0IWThDNNwIBX/XF5mE6d/fQ3ANnU1/z9aG8McRyaqxEqah r+36csPA5dlf11Yf3pdV3cy06XYyTmdRaGbzsVU4gkbub9fNiqj9i/Ks4ELy0obKhjFACzHhclp r5Nw1P7XVOK7dEX6P33QPJhrHi1TCpP9nfDoe1QZ39LiiEU7 X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A With the extp being the only "power" clock left, remove the surrounding loops and handle the extp clock directly. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 24 ++++-------------------- drivers/gpu/drm/msm/hdmi/hdmi.h | 6 +----- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 33 +++++++++++++-----------------= --- 3 files changed, 18 insertions(+), 45 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 818c66efdfed..3a65d82cedc7 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -234,13 +234,11 @@ static const struct hdmi_platform_config hdmi_tx_8960= _config =3D { }; =20 static const char *pwr_reg_names_8x74[] =3D {"core-vdda", "core-vcc"}; -static const char *pwr_clk_names_8x74[] =3D {"extp"}; static const char *hpd_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; static unsigned long hpd_clk_freq_8x74[] =3D {0, 19200000, 0, 0}; =20 static const struct hdmi_platform_config hdmi_tx_8974_config =3D { HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(pwr_clk, 8x74), HDMI_CFG(hpd_clk, 8x74), .hpd_freq =3D hpd_clk_freq_8x74, }; @@ -460,24 +458,10 @@ static int msm_hdmi_dev_probe(struct platform_device = *pdev) hdmi->hpd_clks[i] =3D clk; } =20 - hdmi->pwr_clks =3D devm_kcalloc(&pdev->dev, - config->pwr_clk_cnt, - sizeof(hdmi->pwr_clks[0]), - GFP_KERNEL); - if (!hdmi->pwr_clks) - return -ENOMEM; - - for (i =3D 0; i < config->pwr_clk_cnt; i++) { - struct clk *clk; - - clk =3D msm_clk_get(pdev, config->pwr_clk_names[i]); - if (IS_ERR(clk)) - return dev_err_probe(dev, PTR_ERR(clk), - "failed to get pwr clk: %s\n", - config->pwr_clk_names[i]); - - hdmi->pwr_clks[i] =3D clk; - } + hdmi->extp_clk =3D devm_clk_get_optional(&pdev->dev, "extp"); + if (IS_ERR(hdmi->extp_clk)) + return dev_err_probe(dev, PTR_ERR(hdmi->extp_clk), + "failed to get extp clock\n"); =20 hdmi->hpd_gpiod =3D devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN); /* This will catch e.g. -EPROBE_DEFER */ diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index b7fc1c5f1d1e..1f8c5045a78c 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -51,7 +51,7 @@ struct hdmi { struct regulator_bulk_data *hpd_regs; struct regulator_bulk_data *pwr_regs; struct clk **hpd_clks; - struct clk **pwr_clks; + struct clk *extp_clk; =20 struct gpio_desc *hpd_gpiod; =20 @@ -96,10 +96,6 @@ struct hdmi_platform_config { const char **hpd_clk_names; const long unsigned *hpd_freq; int hpd_clk_cnt; - - /* clks that need to be on for screen pwr (ie pixel clk): */ - const char **pwr_clk_names; - int pwr_clk_cnt; }; =20 struct hdmi_bridge { diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index 438416eaf390..f1790dedf451 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -19,7 +19,7 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; const struct hdmi_platform_config *config =3D hdmi->config; - int i, ret; + int ret; =20 pm_runtime_get_sync(&hdmi->pdev->dev); =20 @@ -27,21 +27,15 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) if (ret) DRM_DEV_ERROR(dev->dev, "failed to enable pwr regulator: %d\n", ret); =20 - if (config->pwr_clk_cnt > 0) { + if (hdmi->extp_clk) { DBG("pixclock: %lu", hdmi->pixclock); - ret =3D clk_set_rate(hdmi->pwr_clks[0], hdmi->pixclock); - if (ret) { - DRM_DEV_ERROR(dev->dev, "failed to set pixel clk: %s (%d)\n", - config->pwr_clk_names[0], ret); - } - } + ret =3D clk_set_rate(hdmi->extp_clk, hdmi->pixclock); + if (ret) + DRM_DEV_ERROR(dev->dev, "failed to set extp clk rate: %d\n", ret); =20 - for (i =3D 0; i < config->pwr_clk_cnt; i++) { - ret =3D clk_prepare_enable(hdmi->pwr_clks[i]); - if (ret) { - DRM_DEV_ERROR(dev->dev, "failed to enable pwr clk: %s (%d)\n", - config->pwr_clk_names[i], ret); - } + ret =3D clk_prepare_enable(hdmi->extp_clk); + if (ret) + DRM_DEV_ERROR(dev->dev, "failed to enable extp clk: %d\n", ret); } } =20 @@ -51,15 +45,15 @@ static void power_off(struct drm_bridge *bridge) struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; const struct hdmi_platform_config *config =3D hdmi->config; - int i, ret; + int ret; =20 /* TODO do we need to wait for final vblank somewhere before * cutting the clocks? */ mdelay(16 + 4); =20 - for (i =3D 0; i < config->pwr_clk_cnt; i++) - clk_disable_unprepare(hdmi->pwr_clks[i]); + if (hdmi->extp_clk) + clk_disable_unprepare(hdmi->extp_clk); =20 ret =3D regulator_bulk_disable(config->pwr_reg_cnt, hdmi->pwr_regs); if (ret) @@ -441,7 +435,6 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(= struct drm_bridge *bridge { struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; - const struct hdmi_platform_config *config =3D hdmi->config; struct msm_drm_private *priv =3D bridge->dev->dev_private; struct msm_kms *kms =3D priv->kms; long actual, requested; @@ -455,8 +448,8 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(= struct drm_bridge *bridge if (kms->funcs->round_pixclk) actual =3D kms->funcs->round_pixclk(kms, requested, hdmi_bridge->hdmi->encoder); - else if (config->pwr_clk_cnt > 0) - actual =3D clk_round_rate(hdmi->pwr_clks[0], requested); + else if (hdmi->extp_clk) + actual =3D clk_round_rate(hdmi->extp_clk, requested); else actual =3D requested; =20 --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 65A27770F1 for ; Sat, 22 Jun 2024 22:02:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093745; cv=none; b=n3PklhrYW4YQCGwrhxbQ9MIbPsnoELBLAYieAkvCbGOKmUa7oC+aJow+8QelblYOwyeXZ/iufyVLX7uPVNDUZq4HfaCsil5DwU+PpMVZQJuYXI3JF4izJzCa91oaH4FPvkInWFpU9bQSOpqH/2aupqqY9ml+nTBDJY1AlU11z9c= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093745; c=relaxed/simple; bh=/H9AIeRGXj1iPiMEVlXfEy/zaUhCvcXeyC4fw6d5vqM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=m0kqTNnGtxeE8jck7eqUz1MmtMO7jN4HEB2QGuOqAiQgTGkeYWEFHEnZI8knQCfL2UKFlEJlymb+SX9+J9R7pvgvoydNnIgQhRJ2m+p9EAIG/t3BKXCx8wxLphY9PZbvTtDvRjUY/Ofn2hbKcNOsqkDqZW6/XjRDq+h1+n1sWis= 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=F9e316zs; arc=none smtp.client-ip=209.85.208.169 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="F9e316zs" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ec1e5505abso34768981fa.1 for ; Sat, 22 Jun 2024 15:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093741; x=1719698541; 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=dUSF3z8flXPuG1mf393BlemBX3xprfFWvuJAVHzccy4=; b=F9e316zs4yCdv6E3OcXSZvXsjhNY4gCAoK+CMCaIoYWj4LQuzJxMft+74rcfq0YxuB x6oQ776i36i92xwWJt2m5g7vRJPeldzJbOLZa0BXjN62j2e7kR9vw/qOLvnwKvFgpjCH 0mzYEErHxhSJNg0n6Vm5SvvyM7aLuCB9MqbZjldvGGwtcrWIWSF5hExhjdXAMkU9Y3fa xe7itryzQNigxhkXLA9yuJqjeGk4wRl9EaRFxum0KhrJQysMIInYcwbX65XCodL2nPjf V6Wfg8cWU+i6AoPh6C2qhphMNU6bRU2P+VgTmtLz3QE+Gly7qskLm1aDP+gDag/S0LST gSug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093741; x=1719698541; 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=dUSF3z8flXPuG1mf393BlemBX3xprfFWvuJAVHzccy4=; b=dBuLtyZ8jo/Jph3ITEXPi8LUscdOiCbtNnJ5yWLb07kAvSUZR3WUd5xQwELQibzF78 Q3N5DbRI3LUe0KGsJiyeW9vIB1vPkyy8KYbp52IT/t6ec66YF/Qx/f9JeL2kiO0fh7vR aAJNwxwZVwrVXUK49+TnLsQLFTaCy+Z5YUuA4LGYwtF6tR0AK0xpCjNLgz9b+0kZ3IhL Jio5uOanqK9UVBmeGF3JLZ8uGXDfwEfb6i5eybOOwj/0ynDgi7+d/uvUOvL4vuatFagg r0b7oTkeLdWaPdSyJB28doEKapafnco7nTo6+qa8kx9FqzR1leso+EMnYhqnriKeM06+ I2Vg== X-Forwarded-Encrypted: i=1; AJvYcCWK24Bl5nke8SHWfTQybzpWgjQHuICoMNoqudQyzL9XJ5zRzUz6ZfMNhxiVRin2T5WCDd0DY6HJTcort9WhKUIYDQCgOMHsJhuriFzY X-Gm-Message-State: AOJu0YzaqVewKXrJEwt6Qgrd2q0dcoiRzidBOULMHgG0z988HqdQkp/s vqScn9XfLJN/Kp7cF3WykMkLVpr/7RJ1BTzEs30xN9aBnAVV0xw5tbnbpuZzb3s= X-Google-Smtp-Source: AGHT+IGMMMmICL3mibO+4e1/Qy4RQb1df6S7as4drSTw9qVUH8VTk4mQZRIsei13f4OmQ9lhypqjyA== X-Received: by 2002:a2e:890e:0:b0:2ec:500c:b2d3 with SMTP id 38308e7fff4ca-2ec56c6cbabmr5669221fa.2.1719093741652; Sat, 22 Jun 2024 15:02:21 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:21 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:17 +0300 Subject: [PATCH v3 04/13] drm/msm/hdmi: drop clock frequency assignment 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: <20240623-fd-hdmi-hpd-v3-4-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2350; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=/H9AIeRGXj1iPiMEVlXfEy/zaUhCvcXeyC4fw6d5vqM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0noU4Zk6ai+BqxKLQv+DuZB+HcLkitfG198w TKh43wQY+mJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6AAKCRCLPIo+Aiko 1XFTCACCZWRtDa5j3veTt161Zzru2wbC1iIJaNc44Trwd8tq0lKZPNaJtAbeZFP22J2h8xrUaYp LT4OKi/B1z2c5RvUzdMh4lnE9mumYKIvvIndLML9nDw8b4Zykw1kSnJMS/aOk7QqZqRxnuZUhS/ mzdPf07mi6DNoOsX1SMaIDRuCZG0Nprsl1+Vh0OGmzawZtVT5ysQtnvykWHr67OohWaJJ7afXqh aSNhYQILCJChPwf6hmk19Cgpg8cpFJsPcOeqIDSar+FkOdOjxzUSTUDAnBym5kh7swsh6Nt0KVy Ml6vk1OxPM86QTaOSHPgXlR9JqC/l8XWsNEfzLKpvxIYAN4V X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The only clock which has frequency being set through hpd_freqs is the "core" aka MDSS_HDMI_CLK clock. It always has the specified frequency, so we can drop corresponding clk_set_rate() call together with the hpd_freq infrastructure. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 2 -- drivers/gpu/drm/msm/hdmi/hdmi.h | 1 - drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 9 --------- 3 files changed, 12 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 3a65d82cedc7..9a39ad1847b9 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -235,12 +235,10 @@ static const struct hdmi_platform_config hdmi_tx_8960= _config =3D { =20 static const char *pwr_reg_names_8x74[] =3D {"core-vdda", "core-vcc"}; static const char *hpd_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; -static unsigned long hpd_clk_freq_8x74[] =3D {0, 19200000, 0, 0}; =20 static const struct hdmi_platform_config hdmi_tx_8974_config =3D { HDMI_CFG(pwr_reg, 8x74), HDMI_CFG(hpd_clk, 8x74), - .hpd_freq =3D hpd_clk_freq_8x74, }; =20 /* diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 1f8c5045a78c..14472b2d6229 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -94,7 +94,6 @@ struct hdmi_platform_config { =20 /* clks that need to be on for hpd: */ const char **hpd_clk_names; - const long unsigned *hpd_freq; int hpd_clk_cnt; }; =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index 9ce0ffa35417..7ae69b14e953 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -68,15 +68,6 @@ static void enable_hpd_clocks(struct hdmi *hdmi, bool en= able) =20 if (enable) { for (i =3D 0; i < config->hpd_clk_cnt; i++) { - if (config->hpd_freq && config->hpd_freq[i]) { - ret =3D clk_set_rate(hdmi->hpd_clks[i], - config->hpd_freq[i]); - if (ret) - dev_warn(dev, - "failed to set clk %s (%d)\n", - config->hpd_clk_names[i], ret); - } - ret =3D clk_prepare_enable(hdmi->hpd_clks[i]); if (ret) { DRM_DEV_ERROR(dev, --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f174.google.com (mail-lj1-f174.google.com [209.85.208.174]) (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 265E57E116 for ; Sat, 22 Jun 2024 22:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093745; cv=none; b=FG1nYxqOXRQ+ibbe0qaj9k5kQgeXl9LuKEAG7SVE/HajyPdPPESl9TnHK1TUfgFkUa9zV2Et/hpVysWcbSrmWrrsUi47LTON2yvVEfR0pK6rEnQDOqvc50nPHc02OE6HexJbD0VE9kNbgZPJ9g+aZxUhYvk1B+O6Ykld6OxJ9rQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093745; c=relaxed/simple; bh=qMMhEiJGtMf2g7v1irJOBZTZd4gqQt3vmkW+yduYJ5w=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VH6y7TgCWysi9gWk3ezFoJ0gUh+bwblyYDvhm7VF4Cm4yzDtAz57is+pH4A9Pns02E6lME+DXcL0PytIIRPMvf1TOTlv2Ujr3/aMmf0xpCX1+TjPWvWLX81G+PtaZw4dUfmPK0bdEGyozJiIIKTZVYQ6eF2JagKeAWRsDk092ek= 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=LwBuFPm7; arc=none smtp.client-ip=209.85.208.174 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="LwBuFPm7" Received: by mail-lj1-f174.google.com with SMTP id 38308e7fff4ca-2eabd22d3f4so38420721fa.1 for ; Sat, 22 Jun 2024 15:02:23 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093742; x=1719698542; 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=IStmo6xiSWG0asaFWCQdK/NUgiLLAmlGd9tuwPv/Qx0=; b=LwBuFPm7in1YOgzE7NSqr4qP4GMq6tEsopol0AM2qZt6EWqUSwVm+lqdirSN3wG1eh tLBnztZFPjOlZLkb/ZqN6fzEr73izNZJWEvjaRDd/A0bfSqMjDXNFRLG+aMFmWFj35ev ykAQ5kfQ40FPpZz41qpu3QbbYfoQGnoZNd+USrHR4a7VVtCn6BOCPRxowhcRrNz/I0tw mCtyf6H+Mipt/Xtg+vC8FcH+PuY5v+X2cTcsjwc0+xJJAc3sEX42CtZ1jx362dvQyUna kOIxn5seVaz7HbhfLAn4E10ENoIBJXax9uZoiwKSV7Ck6css1w9+gsBTT431C0UtdpLX nUzA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093742; x=1719698542; 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=IStmo6xiSWG0asaFWCQdK/NUgiLLAmlGd9tuwPv/Qx0=; b=bPDtrANc9OZNERkS0aMhGf10SPw1rYTSDscIqyP6uZHCfhuiNTqcgAFFhqIFMh0orr Q9CQpZZ6yh2Bm0G7UhpXWC0bEfdoY+EZ3Uht4zSW2me6mDUsEvjK3WDWxbHgirZNJzqg lTcHf8ucAaeA5fV8GSdGfzmJwiCIWY8fqzWjsXb7RKP8yxZk3AzoJiSGg5ZHAr2yhUOC a67w5B/l/OR3RmlgpWKpuiB/lAFyYjmEl4rhXUTKjRBJX4uUVZ+fKYwjLpb8v1F8T6Ip Ee+eVaXhDvYz781XZLwWZdcgmN4GtPyg5sBgMDntcAquKDGzl8cVjxETwVyIrhLKK4ns 9KiQ== X-Forwarded-Encrypted: i=1; AJvYcCXkR1Hoa41I5ZV2KoOd//z7o5UBZ6hy88qgAJIluFjxrerJPSLiVVgn0DeuPnPyQUVjmoKwOuJvbPI0M1ewbjxT4Is2i5SVwZ0K6MZQ X-Gm-Message-State: AOJu0YzTeH6VE4zWyE7keMtFMzuOTpWCi71DkxeX2AaXsGZ6sBry74c/ 2IMMDPx9eCWxHOH2W8XQE5VdIBJzy6+/n0RCR1RAPB6Xf2I9tol/C2XOMNL9BCI= X-Google-Smtp-Source: AGHT+IGZw2H42wRxJ9RELBzDAP73A8ArscgXWtc/kskvhjttQIpurWMQBXx/wCa9YqSVGmJ+FU/ycA== X-Received: by 2002:a2e:bb91:0:b0:2ec:5d83:32da with SMTP id 38308e7fff4ca-2ec5d833347mr723941fa.49.1719093742334; Sat, 22 Jun 2024 15:02:22 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:21 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:18 +0300 Subject: [PATCH v3 05/13] drm/msm/hdmi: switch to clk_bulk API 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: <20240623-fd-hdmi-hpd-v3-5-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4314; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=qMMhEiJGtMf2g7v1irJOBZTZd4gqQt3vmkW+yduYJ5w=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0noBQU1rT1FyJzLhckR2v0eX7J4AfLxZpRoy d67H5nPZKiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6AAKCRCLPIo+Aiko 1daxB/4iHvTDj3eKXXuQIHW9ezTQ5XvP0B+X2hJ8MSDqBPVuF1y3b3M6piEYFQyVphx44+S2XHM EuHs3LUkO5BU2Konqk2/BrVIZyEnRkHJk6y4e8jeMQ3WH8RIFf/IEGrjn7qGWmc1nA2BeNH+Bhe MKV4a258b5NCYtAvBqaUZjyS8PZKedfmpHbItgRdGorqa7YBH6HBBw4IZ/U2pAJac0rK2mKcDwT JO91ws3loQkpjWNFoF1NtKmSeISaos4OYIForCVkGtVB8oBpID9SMadU45F5KrdMuRTRlkWZIJc B2h05d1J89ERRbDb60mu/8yToRHCMfhHEc0kTy/1dN3XSJXY X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The last platform using legacy clock names for HDMI block (APQ8064) switched to new clock names in 5.16. It's time to stop caring about old DT, drop hand-coded helpers and switch to clk_bulk_* API. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 15 +++++--------- drivers/gpu/drm/msm/hdmi/hdmi.h | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 39 +++++++++++++--------------------= ---- 3 files changed, 19 insertions(+), 37 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 9a39ad1847b9..34c1aac5feab 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -444,17 +444,12 @@ static int msm_hdmi_dev_probe(struct platform_device = *pdev) if (!hdmi->hpd_clks) return -ENOMEM; =20 - for (i =3D 0; i < config->hpd_clk_cnt; i++) { - struct clk *clk; + for (i =3D 0; i < config->hpd_clk_cnt; i++) + hdmi->hpd_clks[i].id =3D config->hpd_clk_names[i]; =20 - clk =3D msm_clk_get(pdev, config->hpd_clk_names[i]); - if (IS_ERR(clk)) - return dev_err_probe(dev, PTR_ERR(clk), - "failed to get hpd clk: %s\n", - config->hpd_clk_names[i]); - - hdmi->hpd_clks[i] =3D clk; - } + ret =3D devm_clk_bulk_get(&pdev->dev, config->hpd_clk_cnt, hdmi->hpd_clks= ); + if (ret) + return ret; =20 hdmi->extp_clk =3D devm_clk_get_optional(&pdev->dev, "extp"); if (IS_ERR(hdmi->extp_clk)) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 14472b2d6229..287e6d33fb85 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -50,7 +50,7 @@ struct hdmi { =20 struct regulator_bulk_data *hpd_regs; struct regulator_bulk_data *pwr_regs; - struct clk **hpd_clks; + struct clk_bulk_data *hpd_clks; struct clk *extp_clk; =20 struct gpio_desc *hpd_gpiod; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index 7ae69b14e953..36266aa626dc 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -60,27 +60,6 @@ static void msm_hdmi_phy_reset(struct hdmi *hdmi) } } =20 -static void enable_hpd_clocks(struct hdmi *hdmi, bool enable) -{ - const struct hdmi_platform_config *config =3D hdmi->config; - struct device *dev =3D &hdmi->pdev->dev; - int i, ret; - - if (enable) { - for (i =3D 0; i < config->hpd_clk_cnt; i++) { - ret =3D clk_prepare_enable(hdmi->hpd_clks[i]); - if (ret) { - DRM_DEV_ERROR(dev, - "failed to enable hpd clk: %s (%d)\n", - config->hpd_clk_names[i], ret); - } - } - } else { - for (i =3D config->hpd_clk_cnt - 1; i >=3D 0; i--) - clk_disable_unprepare(hdmi->hpd_clks[i]); - } -} - int msm_hdmi_hpd_enable(struct drm_bridge *bridge) { struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); @@ -107,7 +86,9 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); =20 pm_runtime_get_sync(dev); - enable_hpd_clocks(hdmi, true); + ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + goto fail; =20 msm_hdmi_set_mode(hdmi, false); msm_hdmi_phy_reset(hdmi); @@ -149,7 +130,7 @@ void msm_hdmi_hpd_disable(struct hdmi *hdmi) =20 msm_hdmi_set_mode(hdmi, false); =20 - enable_hpd_clocks(hdmi, false); + clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); pm_runtime_put(dev); =20 ret =3D pinctrl_pm_select_sleep_state(dev); @@ -193,14 +174,20 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) =20 static enum drm_connector_status detect_reg(struct hdmi *hdmi) { - uint32_t hpd_int_status; + const struct hdmi_platform_config *config =3D hdmi->config; + uint32_t hpd_int_status =3D 0; + int ret; =20 pm_runtime_get_sync(&hdmi->pdev->dev); - enable_hpd_clocks(hdmi, true); + ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + goto out; =20 hpd_int_status =3D hdmi_read(hdmi, REG_HDMI_HPD_INT_STATUS); =20 - enable_hpd_clocks(hdmi, false); + clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); + +out: pm_runtime_put(&hdmi->pdev->dev); =20 return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED) ? --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f173.google.com (mail-lj1-f173.google.com [209.85.208.173]) (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 D02D281721 for ; Sat, 22 Jun 2024 22:02:24 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.173 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093746; cv=none; b=d52fI9R75jU7vUXpUH+dyQaYt95nJpJQTH45aQJXCpsqXJxIDarxEbZbVbbWxhDxfcvyhSyY06Ae6dL8y40mRdvpBRI+GhY7o2ig6cw+mdYpyvZ4KubVnCXUDrR7HgBlvpQVp17IUcKi/VrQP6kgra35hOhjIPQU+nDQV3c7pX4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093746; c=relaxed/simple; bh=Cbv9GuAgvf3OlG8nZVtZC4tgrmDTjBkPfIcahMH6TZ0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JeIIFXvJiw+Ko0DjeG3WLPFTUFaTWOroxViML81sRotYuFmMPiiO8ThL/RvpWSPrYAtZoyb/zOUv+SPFNoyel1L4q0o6FXNGU3xRiVMvkYi2l12n1e27NETLS8icSEKRGYDBsk4zwj6c60U8eaLf12JWdlO9aL3stH80Ki7zgE0= 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=hfN3pphg; arc=none smtp.client-ip=209.85.208.173 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="hfN3pphg" Received: by mail-lj1-f173.google.com with SMTP id 38308e7fff4ca-2ec0f3b9cfeso34451701fa.0 for ; Sat, 22 Jun 2024 15:02:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093743; x=1719698543; 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=M7hDmykrt2ZsXc+hmL2IVvYAewI1x1XZlh8sOCSDu6Q=; b=hfN3pphgvIHQ75/jOpsxqtqSCsvqBrXi32vlmoIfARJAq3CAn152QndH/2IuYLoiw5 JeB5walwXbSSHzOC2fsuKjTcErfg1GBml0FUz7OjQVSwzdaPQZg5cxsaed21OFHMnYA1 awcey8RsD8N+vPlgBGKBZEWXpEj2OOY7+NAq1ExFN+DK8a9eQFW1NDxu3Accdqrhzqqn O6cT+Y6I682A1x2nhSxSLWg3S/1kvUckuu1Blq9r5iODBPE5cNC+3ZbaROpjSwr3HjRG xIBpmVpi1ZheokFfZqpzxVYx9pPEVygSETuBB4GPwk9GiEWudj5ScWrAw+Qr7bO3vkZ8 CKMg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093743; x=1719698543; 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=M7hDmykrt2ZsXc+hmL2IVvYAewI1x1XZlh8sOCSDu6Q=; b=GYLNCZEXrOeHF4emztIFqw6hj+F3bXqrJng1JzDltWBV/X51IGJ/QYKIa/VPLQM6zw 2Zof75wDCuHGvAepdbsODXFSo5FbeysNixD14sS9nT0qx9mE2M2zPf7jjvq6hD18kFyU EzSnMffMS6jLeappEYyiAHq+D0GrrCplmGLpwJ/iYqYBu+6g+SROcu3I1HYGW6jIrjiD ihVe5aGYp4/h4f/ybgAhYQnvGnGddhgHY9o+kxrSp/rveVacUXWi5XRAE0RKGvXicwTJ UbNmDiq7eafiRFkD3f7oRKN22nvJrzRRjg/AzIJxei7t3xBxM/UgVI6m6JFd8j3AJNGl z+mw== X-Forwarded-Encrypted: i=1; AJvYcCWA/yz4/sdvQ8vaOwmV3OcHnGghFlOncK0+lrrPdQdGdiFEm0fWY/VKMRrMRHwMPtcyfg1N8vS3JUVt9wowiDZ7TR8n1Xq4VTrFJ3nZ X-Gm-Message-State: AOJu0YxFWcsE1xP/cWmvsmVYLH63EY7PP/OpQU8MSWh3Pv9PisQe4j5z T4A7lx3LuLyRaf/9G1MUm0Tc3LNjAjgws8Cqw+y6Fmj6D+NgZEWL2+HQm5AID6E= X-Google-Smtp-Source: AGHT+IGMDkcXd01ktZF/S0kaLc34zRhGg164j2CXXcedc1M4wVD1mpuhAD7z+e5dXh/RK99uNWUzOw== X-Received: by 2002:a2e:9209:0:b0:2eb:ea62:179c with SMTP id 38308e7fff4ca-2ec59587b4amr7367111fa.53.1719093743010; Sat, 22 Jun 2024 15:02:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:22 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:19 +0300 Subject: [PATCH v3 06/13] drm/msm/hdmi: switch to pm_runtime_resume_and_get() 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: <20240623-fd-hdmi-hpd-v3-6-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2669; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Cbv9GuAgvf3OlG8nZVtZC4tgrmDTjBkPfIcahMH6TZ0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0noKRQoEnzMVJt0pHda4tP7PkcR9J2EWmuxU 2N0uAYXiwSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6AAKCRCLPIo+Aiko 1VLTB/481ZB16vlXyVjafhAnp+jfETZwyHPWvh3Z1uJqQp33jr1iO2n9vmJ5zesmI/DQaDk285k QhoEVabTrrqwRU025RkUDlogx2AOpRWEwvQ/Adu/xhFP9oV74Ru9X9oOWoCiwiMQokV8t3VT6EB JaYIepgYGTSYYokeafI0VmiGpWMte3mKP3AKMA8dwtpiRdy/85jlA31nh2zvPkUVRc/mVLOb2P6 4kcdD07qiOc2NMezmwhwVxrPcjG/Q74N3QRZXOuk6kDjhIAZon0ppyiv7HEEd1Ti/8yBib8vWbi 2bEPi+DWYiawy45L90ETwVjmswoCeBQxvJGEV/AICLtfDIII X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The pm_runtime_get_sync() function is a bad choise for runtime power management. Switch HDMI driver to pm_runtime_resume_and_get() and add proper error handling, while we are at it. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 2 +- drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 12 ++++++++++-- drivers/gpu/drm/msm/hdmi/hdmi_phy.c | 6 +++++- 3 files changed, 16 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index f1790dedf451..34085fd9739b 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -21,7 +21,7 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) const struct hdmi_platform_config *config =3D hdmi->config; int ret; =20 - pm_runtime_get_sync(&hdmi->pdev->dev); + pm_runtime_resume_and_get(&hdmi->pdev->dev); =20 ret =3D regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs); if (ret) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index 36266aa626dc..fc21ad3b01dc 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -85,7 +85,12 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) if (hdmi->hpd_gpiod) gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); =20 - pm_runtime_get_sync(dev); + ret =3D pm_runtime_resume_and_get(dev); + if (ret) { + DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); + goto fail; + } + ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); if (ret) goto fail; @@ -178,7 +183,10 @@ static enum drm_connector_status detect_reg(struct hdm= i *hdmi) uint32_t hpd_int_status =3D 0; int ret; =20 - pm_runtime_get_sync(&hdmi->pdev->dev); + ret =3D pm_runtime_resume_and_get(&hdmi->pdev->dev); + if (ret) + goto out; + ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); if (ret) goto out; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c b/drivers/gpu/drm/msm/hdmi= /hdmi_phy.c index 88a3423b7f24..d5acae752300 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_phy.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_phy.c @@ -58,7 +58,11 @@ int msm_hdmi_phy_resource_enable(struct hdmi_phy *phy) struct device *dev =3D &phy->pdev->dev; int i, ret =3D 0; =20 - pm_runtime_get_sync(dev); + ret =3D pm_runtime_resume_and_get(dev); + if (ret) { + DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); + return ret; + } =20 ret =3D regulator_bulk_enable(cfg->num_regs, phy->regs); if (ret) { --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f177.google.com (mail-lj1-f177.google.com [209.85.208.177]) (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 587C7824A6 for ; Sat, 22 Jun 2024 22:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.177 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093747; cv=none; b=B7ad7zKJkUCutBnahfD/6SNCf2Ef1EgtDL6LAJmFWjs0BxW5vKknbLRvs26jQO8F77kuWMqNOqMLoNFuuJ/jM3k38Y4eVs/WhVjcWeV8iw91WhSrIEaOmd73tTVVJK4rQsMMEbgfFva6nVqDGKtR8/D3e0hrbITHosfALnsytGg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093747; c=relaxed/simple; bh=QxzkmaQ0F6u3Vo6vT1cw2voI5Zf/br+EPvgD/mm50S8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=pij8ds9LxC+HrmjACOChm6gJh5At2o4bwk+5x+Rq9i46e9e+sGhOIk8JQhZBBgsJVhzJZZF8n5pnOje2BNebtWXsWy2igjGxzpvcjJS3iIrxXmxE3qRGEcr9/0XETGCAKK9n+OQl67My+mp5bqC8bS6uj24Z4KKwkcYxrfriv+w= 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=KGyJ3skb; arc=none smtp.client-ip=209.85.208.177 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="KGyJ3skb" Received: by mail-lj1-f177.google.com with SMTP id 38308e7fff4ca-2ec3f875e68so35126841fa.0 for ; Sat, 22 Jun 2024 15:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093743; x=1719698543; 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=CtmbOfPaOUNb/xUduVMXDOuWoblMLauE6Af8hrHbRgE=; b=KGyJ3skbcOMnkv0+8rcbnFntPHhNjQ+wrwkSBvCQWz6rPkHXASzwemR7TZAyZPWcWg 6yC1TcgYi47p2BMHJ86o5N/Ja/NKNtuvQ/UNrBTYJ7GZCLzHZ4HyHlOqBDQMHf1z2kiw VoTct5iquo51U75UYeZqeUJkBRzrDkGa5oVkCtrpdP6XxOA/UdPmAtXpj5XNW/bDaGpm 0lOaOzCtbgN3dDyZ1c+iMTCXGoosUg9CUw+rkj55Z8eYtqKrIrOpSDERxO6OpYsvP30D vlRWydwK4LRQO8wIv+8ch3x8waSRo83R6Ti2XbRCCSFmtgBaqOINeTFnj0WuKDu/3Gde wjew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093743; x=1719698543; 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=CtmbOfPaOUNb/xUduVMXDOuWoblMLauE6Af8hrHbRgE=; b=nMwchhe2+OjKmeyxNGqhS6uANiTHho8IGOB8aZKGGX5/QquHGjMzJ12GFwgK+PV4uJ KVAoqZjwmzGEbC6ehwVzG2Lid46ZDqqZDTY++BMDOuex5bIUW61D+50sxRc470qxHYU6 WIsM+Inj16uYzAGFq7sZ9CbHRcWSQgIu4d9BYgC0Xu+H+IKjIOSjGdTCn6h/P/BheyfY XoCszftNjbP18Vd2GIXCcEEvfMxqiQhdPfvPHNq+mYrGGw+qu4vQhE1pXrXNh+XFDUS6 nmqeqw1+oAcj2KHMkfMLqXQ3oPWrASG8PSaVlLtsBmfa80p1fWxBIN31QHwOGzR2VZiU 4oIQ== X-Forwarded-Encrypted: i=1; AJvYcCXj+YxQ6bNWAe1CY+0Z+BEtHcz+TRtMao6lOQF6Ah7Y1gEqgJwQVfxFDSfJGUWaRsY2Oo5RH/kixE2KKAXb/tF7SFkyVW4GefopwKx+ X-Gm-Message-State: AOJu0YwljxbykCrTMjJChaTVIfysFA8BTQ8ZbFDUgwpac58V4FfLoP3q T+mJWbL/9szPCvWR/LOVdc9eXcmGg1smzyNVC9VVEKNzjZcIqOl08vY/XV6z8Cc= X-Google-Smtp-Source: AGHT+IFwxLQa126PcNr0V293dyG07jdnFORLo0TrMcMkOvdVXZTtsEVGMDFPHgMRWJ3JGAyugxXTPQ== X-Received: by 2002:a2e:730b:0:b0:2ec:5933:a624 with SMTP id 38308e7fff4ca-2ec5b38ac4amr4414821fa.25.1719093743672; Sat, 22 Jun 2024 15:02:23 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:23 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:20 +0300 Subject: [PATCH v3 07/13] drm/msm/hdmi: add runtime PM calls to DDC transfer 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: <20240623-fd-hdmi-hpd-v3-7-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=1574; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=QxzkmaQ0F6u3Vo6vT1cw2voI5Zf/br+EPvgD/mm50S8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0npagDRaaHh/etYkVpsH1SbuurrBPWY5IUbT LQyDC7RbTSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6QAKCRCLPIo+Aiko 1T0yCACmTbalmvI7VNRR8xt6vysRhyetuTY3yYoAhuQmrYq9Kc/rqU8+HkB7jRrjHNfAa7O7Vvq BQTnhAqZonSES2XQ2coTU0c7OjZ+p7/TaxqwbYZcSuzeJMArHsr8knx5Yl7B5ssga8SglXieMto CX/HoukjQfeVmqLolpBwbMbyG3JvXR+UJeYKAODnNdPm94Lg0Z8VoAZY3ksdXf8SNIFcaS1WMJh gDUmAo9WqNskxyMYujkhs/Q9fKGGYuAuRraeMnt7WmBjFuvKCa2IikDDTh+nI0UCfXbYRIT3zZI uxYEjV5LeNUUlpAhxEQiGOkD6DKwgRtUi9cY2V9y2kb9LDnb X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A We must be sure that the HDMI controller is powered on, while performing the DDC transfer. Add corresponding runtime PM calls to msm_hdmi_i2c_xfer(). Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_i2c.c | 14 ++++++++++++-- 1 file changed, 12 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c b/drivers/gpu/drm/msm/hdmi= /hdmi_i2c.c index 7aa500d24240..ebefea4fb408 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_i2c.c @@ -107,11 +107,15 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, if (num =3D=3D 0) return num; =20 + ret =3D pm_runtime_resume_and_get(&hdmi->pdev->dev); + if (ret) + return ret; + init_ddc(hdmi_i2c); =20 ret =3D ddc_clear_irq(hdmi_i2c); if (ret) - return ret; + goto fail; =20 for (i =3D 0; i < num; i++) { struct i2c_msg *p =3D &msgs[i]; @@ -169,7 +173,7 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS), hdmi_read(hdmi, REG_HDMI_DDC_HW_STATUS), hdmi_read(hdmi, REG_HDMI_DDC_INT_CTRL)); - return ret; + goto fail; } =20 ddc_status =3D hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS); @@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, } } =20 + pm_runtime_put(&hdmi->pdev->dev); + return i; + +fail: + pm_runtime_put(&hdmi->pdev->dev); + return ret; } =20 static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter) --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f181.google.com (mail-lj1-f181.google.com [209.85.208.181]) (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 2C34383CCC for ; Sat, 22 Jun 2024 22:02:25 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.181 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093748; cv=none; b=Mb2EZ9bGVdPXbbPa8YXuwaZAPX4ES3x3+SUFINEzWuixjWpFdYzMDKPzesVDJOOdCI1907aBGbZ3ISiWXbcnd0NuPRJSHgwN6hr+qaEugDab8CmE6zRGhwTMcPXk5budEQ81xaBf/sgzSRTxruGlhDET//t5+O9XOEJxLosuXUw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093748; c=relaxed/simple; bh=mQloSjtrsjqhU2L6hIFvR1BP80Q+I1J3zHW4IrRsJTI=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Fmked4TcQVl/6jwGJ8itlplbQ6q3sX9+9iw6sapziflh4vbTV6lFSe0oe1crtLsCo4fMTMpdQg2O08OANdgzeVh2uYhgVdVUsZfJQQGShAf1jNHob0YDN8B6Ua8j/e7+DrOuos/SJJqW7iyKq9UwFoRrQ5gYZM+Zxu1fWdbvERI= 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=oprBbN45; arc=none smtp.client-ip=209.85.208.181 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="oprBbN45" Received: by mail-lj1-f181.google.com with SMTP id 38308e7fff4ca-2ec3f875e68so35126951fa.0 for ; Sat, 22 Jun 2024 15:02:25 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093744; x=1719698544; 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=uT8pxGU5UTAsCymYW05fV+pVSft8bYR/hRo4Hqglb7k=; b=oprBbN45XhESpkXsa5INCCLNETIlHZX7JAuRuqA7z6WghFjWUNbYB5jBTolGtbpeAb 0HFxjOnDkMehWbE+1Jsu21Y3Oy6tu4dWZ4X65itMWKIByqGa0bKVRWhYFOykGNhkX13u MppOeMR75kdwDWliG23a5eqij2eJSCptnhpxt/1HSy312Gnu8qLAZQvhvc2BpEp3vLfu qK/G1O6zec4fkd3sVi/OAt0h+feiMmMRnRh4CLuPs8gK3VNSwOMw3QZ958XfuAVzmKjf nIJug4cEDZS1mrSlmz3EqyjYvM+7wnRROv0L4vOnMUz4UyYTExwQluQ1z/BqebOREDJ8 faKQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093744; x=1719698544; 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=uT8pxGU5UTAsCymYW05fV+pVSft8bYR/hRo4Hqglb7k=; b=XaOCIFsBjZ7nrRQ+PRQltoYxk+a70DuqWKFviNpTow9EOxezJ39OG/WHgboeyxKHdm ssAmX5KHhRPPuIHTGNK1HZGS7ZsiPnzqNr+uEcrAZJNo3M0KmeiFHc8ap0rMNP8/xU6T TRtzLBx8ipTtOACR4TjU0D3tj3BO475v0G4UTsQHqH0hW4u/suKg1gjNDdrbRPVstr0S J81SlF9ObSNtFZDt64RTsBuQvqkGwOAf8HVTkmiJnyUyH4nEq+8v/bF461B/fwVYSB78 W89fPpPjfnTuzIQyVkHpXQTK7ne4X9nR0zHEGGNBR0F9CDSjqR8wikn01i6K83C4GO2R w4hQ== X-Forwarded-Encrypted: i=1; AJvYcCVAMr221bx7QtcXynEYJd7RIAMW62+cRb+MhCdX/jnjI1zsLvG1JRcYhrg25e8tO4KyWHpv30PEN21BRyPRVJlsgj0AG/eEp0I3OFKB X-Gm-Message-State: AOJu0YwbFJRTh3ten4sBUNsTIZ6rVtcLR/l7L71ettcX1I7nGygaBUch F3JVlG8vhipi9HEmzwVBN+GEl7ZigblwhDUfVs/Bn/NLcwavWq+936CWkGvwQoM= X-Google-Smtp-Source: AGHT+IHRYo0K72vEZY8snfrX/bOUeGz2EYtECl/EEjoK3IEoWA2Ma+QZrP7byvh9lydf6kpApuJ/cA== X-Received: by 2002:a2e:7e0f:0:b0:2ec:56b9:259f with SMTP id 38308e7fff4ca-2ec5b3e24d7mr3668581fa.48.1719093744389; Sat, 22 Jun 2024 15:02:24 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:23 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:21 +0300 Subject: [PATCH v3 08/13] drm/msm/hdmi: implement proper runtime PM handling 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: <20240623-fd-hdmi-hpd-v3-8-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=9172; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=mQloSjtrsjqhU2L6hIFvR1BP80Q+I1J3zHW4IrRsJTI=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ1q558sreXotoTe8XGbfXnFwS0D0ioe/g+yZrjYpLbvfE qW6TOpvJ6MxCwMjF4OsmCKLT0HL1JhNyWEfdkythxnEygQyhYGLUwAmstmPg6FRV6PP6ua1ln2G Cy5pL0lN2mDd+YVVt1Y2ceXDyECXD3l9vTvf3lSYxNW0e5rr7Jnl1VwbC1dkdJutD/F+fP7hOuN ZJ2flnf/spdLavqTRKbAno7puf5BXyPVIydgT1jbszYsc5/GsuRQiyt9dELtH4DBXW/+e/mjvqd v5vVyFj6Qlrvi9Rfnzv+e9Zxom79j1Vz/WXeVwkwfjtDfep1304racqC5xzxBzZGdiyVHhad3ga dX79OEh1XV6f9xcf3g5Gr49vEZdN9rswqfiibF31j+Y1J4f2LODO3ziXPGcvc9Y3s2TivwiezCR b8b1Rvm4oJ1b9VlV1LZeuC+ekuiu7KHq1fpvvclx38RiAA== X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A It is completely not obvious, but the so-called 'hpd' clocks and regulators are required for the HDMI host to function properly. Merge pwr and hpd regulators. Use regulators, clocks and pinctrl to implement proper runtime PM callbacks. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 62 +++++++++++++++++++++++++-----= ---- drivers/gpu/drm/msm/hdmi/hdmi.h | 7 +--- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 12 ------- drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 42 +---------------------- 4 files changed, 48 insertions(+), 75 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 34c1aac5feab..ba9d4671e722 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -8,6 +8,7 @@ #include #include #include +#include #include =20 #include @@ -225,11 +226,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, .item ## _names =3D item ##_names_ ## entry, \ .item ## _cnt =3D ARRAY_SIZE(item ## _names_ ## entry) =20 -static const char *hpd_reg_names_8960[] =3D {"core-vdda"}; +static const char *pwr_reg_names_8960[] =3D {"core-vdda"}; static const char *hpd_clk_names_8960[] =3D {"core", "master_iface", "slav= e_iface"}; =20 static const struct hdmi_platform_config hdmi_tx_8960_config =3D { - HDMI_CFG(hpd_reg, 8960), + HDMI_CFG(pwr_reg, 8960), HDMI_CFG(hpd_clk, 8960), }; =20 @@ -409,20 +410,6 @@ static int msm_hdmi_dev_probe(struct platform_device *= pdev) if (hdmi->irq < 0) return hdmi->irq; =20 - hdmi->hpd_regs =3D devm_kcalloc(&pdev->dev, - config->hpd_reg_cnt, - sizeof(hdmi->hpd_regs[0]), - GFP_KERNEL); - if (!hdmi->hpd_regs) - return -ENOMEM; - - for (i =3D 0; i < config->hpd_reg_cnt; i++) - hdmi->hpd_regs[i].supply =3D config->hpd_reg_names[i]; - - ret =3D devm_regulator_bulk_get(&pdev->dev, config->hpd_reg_cnt, hdmi->hp= d_regs); - if (ret) - return dev_err_probe(dev, ret, "failed to get hpd regulators\n"); - hdmi->pwr_regs =3D devm_kcalloc(&pdev->dev, config->pwr_reg_cnt, sizeof(hdmi->pwr_regs[0]), @@ -500,6 +487,48 @@ static void msm_hdmi_dev_remove(struct platform_device= *pdev) msm_hdmi_put_phy(hdmi); } =20 +static int msm_hdmi_runtime_suspend(struct device *dev) +{ + struct hdmi *hdmi =3D dev_get_drvdata(dev); + const struct hdmi_platform_config *config =3D hdmi->config; + + clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); + + pinctrl_pm_select_sleep_state(dev); + + regulator_bulk_disable(config->pwr_reg_cnt, hdmi->pwr_regs); + + return 0; +} + +static int msm_hdmi_runtime_resume(struct device *dev) +{ + struct hdmi *hdmi =3D dev_get_drvdata(dev); + const struct hdmi_platform_config *config =3D hdmi->config; + int ret; + + ret =3D regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs); + if (ret) + return ret; + + ret =3D pinctrl_pm_select_default_state(dev); + if (ret) + goto fail; + + ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + goto fail; + + return 0; + +fail: + pinctrl_pm_select_sleep_state(dev); + + return ret; +} + +DEFINE_RUNTIME_DEV_PM_OPS(msm_hdmi_pm_ops, msm_hdmi_runtime_suspend, msm_h= dmi_runtime_resume, NULL); + static const struct of_device_id msm_hdmi_dt_match[] =3D { { .compatible =3D "qcom,hdmi-tx-8996", .data =3D &hdmi_tx_8974_config }, { .compatible =3D "qcom,hdmi-tx-8994", .data =3D &hdmi_tx_8974_config }, @@ -516,6 +545,7 @@ static struct platform_driver msm_hdmi_driver =3D { .driver =3D { .name =3D "hdmi_msm", .of_match_table =3D msm_hdmi_dt_match, + .pm =3D &msm_hdmi_pm_ops, }, }; =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 287e6d33fb85..07a1b3641cb4 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -48,7 +48,6 @@ struct hdmi { void __iomem *qfprom_mmio; phys_addr_t mmio_phy_addr; =20 - struct regulator_bulk_data *hpd_regs; struct regulator_bulk_data *pwr_regs; struct clk_bulk_data *hpd_clks; struct clk *extp_clk; @@ -84,11 +83,7 @@ struct hdmi { =20 /* platform config data (ie. from DT, or pdata) */ struct hdmi_platform_config { - /* regulators that need to be on for hpd: */ - const char **hpd_reg_names; - int hpd_reg_cnt; - - /* regulators that need to be on for screen pwr: */ + /* regulators that need to be on: */ const char **pwr_reg_names; int pwr_reg_cnt; =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index 34085fd9739b..c15c49c08d30 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -18,15 +18,10 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) struct drm_device *dev =3D bridge->dev; struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; - const struct hdmi_platform_config *config =3D hdmi->config; int ret; =20 pm_runtime_resume_and_get(&hdmi->pdev->dev); =20 - ret =3D regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs); - if (ret) - DRM_DEV_ERROR(dev->dev, "failed to enable pwr regulator: %d\n", ret); - if (hdmi->extp_clk) { DBG("pixclock: %lu", hdmi->pixclock); ret =3D clk_set_rate(hdmi->extp_clk, hdmi->pixclock); @@ -41,11 +36,8 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) =20 static void power_off(struct drm_bridge *bridge) { - struct drm_device *dev =3D bridge->dev; struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; - const struct hdmi_platform_config *config =3D hdmi->config; - int ret; =20 /* TODO do we need to wait for final vblank somewhere before * cutting the clocks? @@ -55,10 +47,6 @@ static void power_off(struct drm_bridge *bridge) if (hdmi->extp_clk) clk_disable_unprepare(hdmi->extp_clk); =20 - ret =3D regulator_bulk_disable(config->pwr_reg_cnt, hdmi->pwr_regs); - if (ret) - DRM_DEV_ERROR(dev->dev, "failed to disable pwr regulator: %d\n", ret); - pm_runtime_put(&hdmi->pdev->dev); } =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index fc21ad3b01dc..32e447267e3b 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -64,36 +64,17 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) { struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; - const struct hdmi_platform_config *config =3D hdmi->config; struct device *dev =3D &hdmi->pdev->dev; uint32_t hpd_ctrl; int ret; unsigned long flags; =20 - ret =3D regulator_bulk_enable(config->hpd_reg_cnt, hdmi->hpd_regs); - if (ret) { - DRM_DEV_ERROR(dev, "failed to enable hpd regulators: %d\n", ret); - goto fail; - } - - ret =3D pinctrl_pm_select_default_state(dev); - if (ret) { - DRM_DEV_ERROR(dev, "pinctrl state chg failed: %d\n", ret); - goto fail; - } - if (hdmi->hpd_gpiod) gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); =20 ret =3D pm_runtime_resume_and_get(dev); - if (ret) { - DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); - goto fail; - } - - ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); if (ret) - goto fail; + return ret; =20 msm_hdmi_set_mode(hdmi, false); msm_hdmi_phy_reset(hdmi); @@ -119,32 +100,18 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) spin_unlock_irqrestore(&hdmi->reg_lock, flags); =20 return 0; - -fail: - return ret; } =20 void msm_hdmi_hpd_disable(struct hdmi *hdmi) { - const struct hdmi_platform_config *config =3D hdmi->config; struct device *dev =3D &hdmi->pdev->dev; - int ret; =20 /* Disable HPD interrupt */ hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, 0); =20 msm_hdmi_set_mode(hdmi, false); =20 - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); pm_runtime_put(dev); - - ret =3D pinctrl_pm_select_sleep_state(dev); - if (ret) - dev_warn(dev, "pinctrl state chg failed: %d\n", ret); - - ret =3D regulator_bulk_disable(config->hpd_reg_cnt, hdmi->hpd_regs); - if (ret) - dev_warn(dev, "failed to disable hpd regulator: %d\n", ret); } =20 void msm_hdmi_hpd_irq(struct drm_bridge *bridge) @@ -179,7 +146,6 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) =20 static enum drm_connector_status detect_reg(struct hdmi *hdmi) { - const struct hdmi_platform_config *config =3D hdmi->config; uint32_t hpd_int_status =3D 0; int ret; =20 @@ -187,14 +153,8 @@ static enum drm_connector_status detect_reg(struct hdm= i *hdmi) if (ret) goto out; =20 - ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); - if (ret) - goto out; - hpd_int_status =3D hdmi_read(hdmi, REG_HDMI_HPD_INT_STATUS); =20 - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); - out: pm_runtime_put(&hdmi->pdev->dev); =20 --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f180.google.com (mail-lj1-f180.google.com [209.85.208.180]) (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 D25E484E00 for ; Sat, 22 Jun 2024 22:02:26 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.180 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093748; cv=none; b=EGgzz5ZC+zFqJtAyp2O7t4AffLd+OS9XQT9m/04rVWjgk1ECrgTtDAmGP6c4nQREncifSg15171d0Qpn90gxSjsyK2/QzTkIMPxuf0kOdY1KNwAkWRuSD3cpieH55UPBG2sLbSEsewvrYpBMHG9RBnDrpW9qdyOzCYd0lZ36nBw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093748; c=relaxed/simple; bh=oep80Z2K2Jlzuj2Eg41CQ0HynF66YnEBtDALprDk3E4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ehbAuPll5+sxftthg/Auo8SMvIgxo2gItbqAmJzoI+2R8PnirP8Uil4fjikVbQjgSAluMK+4soDsD0rK9cJtB2Pj9CGXSBFIHl7YwuDB83Zkp8aPCOIHsxCAq9KfMPfO+1vagbKr+jBaAWFUsQbMWk7t0e1Wp8l1I+DM9kT7nLs= 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=QWCJFmr3; arc=none smtp.client-ip=209.85.208.180 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="QWCJFmr3" Received: by mail-lj1-f180.google.com with SMTP id 38308e7fff4ca-2ec10324791so35304291fa.1 for ; Sat, 22 Jun 2024 15:02:26 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093745; x=1719698545; 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=ioH0kSreVM5204+/7ne4leOKqkukfnp1CbQNa7kS3uE=; b=QWCJFmr31BONpEL7JPMjwB8mqA6WyhetDgxVB6H9O4IChoPArH6Y8PdkkzymPFlSSt 3x0NCOkuXgG6zReQrNlqSP2J1TMR3XC1FQ2iya05xfrkqPMFCuR6V9tNl2AWpFgvQLrp 97LEu8FpxACWGleCCQStVlqtQzHZFHBtYxPUGkuczGEZNhAgljoQw0mwpvymt0M7L589 9WYUu8XD+sH2D/diQLhLgnCVyc2DlEMhqDfxwi3jihFGXhGnuj/agirD/iYx81V4ejQL 2KUu36N/6KTejuH330R6AuTYzznGupp4srjoaLkt/tXQlvQwXF1lJBmDBOTKsBn2czjd dDdw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093745; x=1719698545; 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=ioH0kSreVM5204+/7ne4leOKqkukfnp1CbQNa7kS3uE=; b=wHBaVE04p5E0FeFm+qZn2pPiHIkczRg5EnKRDXMfpEh8QBli2yDVMHj8SXGFBJ3pMy eHFLQtMf7r2pCY9aujAKYcv0Uy4cdYjiX5xQXytXq38lcfi86MWOiGIhCdfhpHbXmwyD slhNmKmq9Bo9yU/7f4UY3UmRe8ouUgszof6rsU7WoXnaZh2zvMP0sk6l0RF1WqdnbGUN 3s1zu8ENUiv2erodsemPJWj75LYpHmANfcjnzpImlixQD2VaDqAE7kR0tAGA6gSAxGxC NVcKdAgPAfT33HCixPYH4OueqI05UeVx70D7GyYAkvUXhfI1s3/c5XPYJtKvv9HkTl7b 2o2w== X-Forwarded-Encrypted: i=1; AJvYcCXyG/G2OhTL9GVxsezEa7ij89ifs8/v78i72ebnrUgGZySerVB9xiF9XXndC7Cw3duOvhBuQcvQz5fCc59HXExFzCmK6wd70/OwEDg6 X-Gm-Message-State: AOJu0Yxh56g/1ShaNT4nv8XMBuZAg7rGU2HeqnXe6MxnebEb1EmF9y2z eg7YIH8U5HAoroChB5KSQhEQnGI2UOKWaerKG+ko0rvt9YDx2hIJUkM1FFobJ+uy1odtCdSf6qR ElBc= X-Google-Smtp-Source: AGHT+IHLZImmyK/pnWuG95FTV4gPoOc4QrSl/5rfdttMADBUeCz4FORFiopsCOPQ/T2IE9zD/EoBfw== X-Received: by 2002:a05:651c:158:b0:2ec:55b5:ed51 with SMTP id 38308e7fff4ca-2ec5b269428mr3933681fa.9.1719093745055; Sat, 22 Jun 2024 15:02:25 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:24 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:22 +0300 Subject: [PATCH v3 09/13] drm/msm/hdmi: rename hpd_clks to pwr_clks 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: <20240623-fd-hdmi-hpd-v3-9-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3839; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=oep80Z2K2Jlzuj2Eg41CQ0HynF66YnEBtDALprDk3E4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0npW5YjQsuxKinGOs6lp8xkrkAjZaRt95LyJ DooBKPfNW6JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6QAKCRCLPIo+Aiko 1X9aCACRFOh7HaRBPiIiaYjv3mjSh2+kuhlJTYB3/XUytpF2cyr1uqPAkiBwAHEpK93iCoX/Dnd CQxgdITWruqkhCdKipQ03Zuv2O/fOWZYkfq2dhASOOENyZnpdn3c3BZxg9/menjtSqwxQGFW4IM ws2lqUw4eZ4JHdbpUjpKtN4FeOoPI6TFpgXp7Yz+IzdCGMiznZKMhO0pPoTtxgPNyh92XDw9fPM sodwd7TNUvUnUzUuN/ruOywqQ7H3YG2kNLZUoNNFaGRJKWzsLSqYqFsoPAVWHN4EJOICdiqxMbZ RR/ln9e7DIXHKCBKVJs33vORXul18MmXpugKbSOUTpu/Lg0s X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A As these clocks are now used in the runtime PM callbacks, they have no connection to 'HPD'. Rename corresponding fields to follow clocks purpose, to power up the HDMI controller. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 26 +++++++++++++------------- drivers/gpu/drm/msm/hdmi/hdmi.h | 6 +++--- 2 files changed, 16 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index ba9d4671e722..48dd1843ea1f 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -227,19 +227,19 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, .item ## _cnt =3D ARRAY_SIZE(item ## _names_ ## entry) =20 static const char *pwr_reg_names_8960[] =3D {"core-vdda"}; -static const char *hpd_clk_names_8960[] =3D {"core", "master_iface", "slav= e_iface"}; +static const char *pwr_clk_names_8960[] =3D {"core", "master_iface", "slav= e_iface"}; =20 static const struct hdmi_platform_config hdmi_tx_8960_config =3D { HDMI_CFG(pwr_reg, 8960), - HDMI_CFG(hpd_clk, 8960), + HDMI_CFG(pwr_clk, 8960), }; =20 static const char *pwr_reg_names_8x74[] =3D {"core-vdda", "core-vcc"}; -static const char *hpd_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; +static const char *pwr_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; =20 static const struct hdmi_platform_config hdmi_tx_8974_config =3D { HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(hpd_clk, 8x74), + HDMI_CFG(pwr_clk, 8x74), }; =20 /* @@ -424,17 +424,17 @@ static int msm_hdmi_dev_probe(struct platform_device = *pdev) if (ret) return dev_err_probe(dev, ret, "failed to get pwr regulators\n"); =20 - hdmi->hpd_clks =3D devm_kcalloc(&pdev->dev, - config->hpd_clk_cnt, - sizeof(hdmi->hpd_clks[0]), + hdmi->pwr_clks =3D devm_kcalloc(&pdev->dev, + config->pwr_clk_cnt, + sizeof(hdmi->pwr_clks[0]), GFP_KERNEL); - if (!hdmi->hpd_clks) + if (!hdmi->pwr_clks) return -ENOMEM; =20 - for (i =3D 0; i < config->hpd_clk_cnt; i++) - hdmi->hpd_clks[i].id =3D config->hpd_clk_names[i]; + for (i =3D 0; i < config->pwr_clk_cnt; i++) + hdmi->pwr_clks[i].id =3D config->pwr_clk_names[i]; =20 - ret =3D devm_clk_bulk_get(&pdev->dev, config->hpd_clk_cnt, hdmi->hpd_clks= ); + ret =3D devm_clk_bulk_get(&pdev->dev, config->pwr_clk_cnt, hdmi->pwr_clks= ); if (ret) return ret; =20 @@ -492,7 +492,7 @@ static int msm_hdmi_runtime_suspend(struct device *dev) struct hdmi *hdmi =3D dev_get_drvdata(dev); const struct hdmi_platform_config *config =3D hdmi->config; =20 - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); + clk_bulk_disable_unprepare(config->pwr_clk_cnt, hdmi->pwr_clks); =20 pinctrl_pm_select_sleep_state(dev); =20 @@ -515,7 +515,7 @@ static int msm_hdmi_runtime_resume(struct device *dev) if (ret) goto fail; =20 - ret =3D clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + ret =3D clk_bulk_prepare_enable(config->pwr_clk_cnt, hdmi->pwr_clks); if (ret) goto fail; =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 07a1b3641cb4..9bc4bd6761de 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -49,7 +49,7 @@ struct hdmi { phys_addr_t mmio_phy_addr; =20 struct regulator_bulk_data *pwr_regs; - struct clk_bulk_data *hpd_clks; + struct clk_bulk_data *pwr_clks; struct clk *extp_clk; =20 struct gpio_desc *hpd_gpiod; @@ -88,8 +88,8 @@ struct hdmi_platform_config { int pwr_reg_cnt; =20 /* clks that need to be on for hpd: */ - const char **hpd_clk_names; - int hpd_clk_cnt; + const char **pwr_clk_names; + int pwr_clk_cnt; }; =20 struct hdmi_bridge { --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f172.google.com (mail-lj1-f172.google.com [209.85.208.172]) (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 A3B8E129E94 for ; Sat, 22 Jun 2024 22:02:27 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093749; cv=none; b=jGz63dg0EvUMPg+zTpdRY7vsTtkI/L4eYwfruW+jSNueErONTQMYt17Nkpn82QcyahAkOK6RYmXvcHWyI7WBie/2L/LUjVB+gR5Cw1361S6AuvT/Ib/5cJG4cSRWlucOGOvW0qcr86/bYbOoLFUEP+8Nrt76S411ZBhIsDMylO4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093749; c=relaxed/simple; bh=c8linT71WnUmb2XL4MjDcI9MoIjYqa8Jfex5sF8uhhg=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=ceptvM7qDOyauIRghL+Aybca6exdDtzoN8LkYhOBU3O3huoqSdvZ5tCl1R4Cg6X98Uwp+8Mu4RU82xGpp6ASzMi3qTeGmA6evXep6kjaatMsawi7D2oC+JxsKoQUTmzjJfeSQRC6upLUWYJS9CuuVdJwaXFR92uNgE/91jHWfos= 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=lg3k0beJ; arc=none smtp.client-ip=209.85.208.172 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="lg3k0beJ" Received: by mail-lj1-f172.google.com with SMTP id 38308e7fff4ca-2ebec2f11b7so33559041fa.2 for ; Sat, 22 Jun 2024 15:02:27 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093746; x=1719698546; 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=hcLXGMyi48kmnj7pjstYNNfWzbNrifnXYs8snVK6Jn4=; b=lg3k0beJMCcdx7US7mZlhJd/4sAiI3vWMWjrWoCxR5p5CweZVYNhQC+3IQy8tB7Dar R71WgzdORdpmGyBBmVyJbx5WXhJ86Ybo5KXNqgAdZBtuZGIuHB45rvRpTJlBGid7pjgA 0XrnaZ8ec4erzT/QmeHj9giQjMfOiXz0PPZ6QQHejhJTfhCpiEilrNas7N3bjFNcSmUm d7oHf0UytLZfDGasF/J+Z4keA6z7K16QhzkI0BkyjIE0AZz2dvU7raksgv0OlDm53rQd rr4g8T62qv63x7PZaQOFLJJpmtoIKx4NRAp9zgWV4ulvXvN7pyDUo+EA5jUqsUXhneST bh1A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093746; x=1719698546; 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=hcLXGMyi48kmnj7pjstYNNfWzbNrifnXYs8snVK6Jn4=; b=r9DwyQpO+agoCwYpqrJk37xKnH1PO/NVIaSKHCM/Y4UPbgT6I+2lzIMZgO3vW0yRDs EaLQThiL58Ig9PDg221k11WhVpi4SoyljJFlvrzIL4gjmwJFBuxpsjLPLS0oaWzjCLpd z2lscDoHLibmjlHG2TD3cYDKrp2WVyfIQ7f+MpNqUR9zp0Ed2MPIC7ATwNuyYRKIuTv9 pVBnTOLE2D85z6NT0c1ryMWd+xPI8zjijjfxaOaWy1/+EvaLyWDj2xWZyxoijRr5HpFo +5hoLjzeinnZB3dScCAPHU9YsZhl7VYjNQrnDi8xyGQ71Z6Tznn/gWU77lGpKbgfLz6i krBw== X-Forwarded-Encrypted: i=1; AJvYcCXa0IxQ9YbV6sbX1exxCSBAcZ0szkxpfZALvKkMBs1xId5LPx2wVE1GG/2No8Zvsg06mgFdMb2T+M81GB9nZhXdgrVN3QooF28TrgnF X-Gm-Message-State: AOJu0Yzco14EWBQkR81fRCCfM4Mqb+pk1znZKP1WydLD329PvuZ0nToE YUxydVmX8TvPWEroWzpT3X1gtOvplIrBptoyRIarMUex+6h6kBbXr0XG5akJKi4= X-Google-Smtp-Source: AGHT+IEosm1MB8sVMKXefmGRiaVDftf+7yDqEsDBy2wvjyJ7dnTWcgC8vmNbs+aNIEBPJzhSJChLuw== X-Received: by 2002:a2e:994f:0:b0:2ec:4fea:8b9e with SMTP id 38308e7fff4ca-2ec5b337a97mr4258801fa.15.1719093745913; Sat, 22 Jun 2024 15:02:25 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:25 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:23 +0300 Subject: [PATCH v3 10/13] drm/msm/hdmi: expand the HDMI_CFG macro 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: <20240623-fd-hdmi-hpd-v3-10-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=2236; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=c8linT71WnUmb2XL4MjDcI9MoIjYqa8Jfex5sF8uhhg=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0npxQE+1N8qoZFUtMdjZ+FEG5yO3+10/F2ly w+8ND4VQ7mJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6QAKCRCLPIo+Aiko 1VN5B/0VeC+RdpAdyBSPOw5fDyKRSeXRtfm3jDRuz2kdmzp+6j+2ra1isZBr/dsTEm6TLHuL+8i Vr83ibPymZn2baMMSl+jxPqbiVY/Tx2W5l3wargUjKixUCnC6ilkyQJtFcpV/f7XZ8RlSc9mn/G +++cAG5s7k6JVroJt70muCE2VWSCNU8SYzQ14IZDP4wP85pmG1bz0HHp4UnbhOFuTvJ0k8oo4HN 8LfFLuImZ5kf0WJhBk3oPvTtuGHtg9uPPIXwd3LpEUAPZmWJEyO48wHOVcOb3BiHvQKSmIamFP8 ket0CfVSADHb1eS6IHCr9Ve6pdFyR6FY+A3/0rqrsTq8q2ci X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Expand the HDMI_CFG() macro in HDMI config description. It has no added value other than hiding some boilerplate declarations. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 16 ++++++++-------- drivers/gpu/drm/msm/hdmi/hdmi.h | 2 +- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 48dd1843ea1f..5ba9a23ef122 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -222,24 +222,24 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, * The hdmi device: */ =20 -#define HDMI_CFG(item, entry) \ - .item ## _names =3D item ##_names_ ## entry, \ - .item ## _cnt =3D ARRAY_SIZE(item ## _names_ ## entry) - static const char *pwr_reg_names_8960[] =3D {"core-vdda"}; static const char *pwr_clk_names_8960[] =3D {"core", "master_iface", "slav= e_iface"}; =20 static const struct hdmi_platform_config hdmi_tx_8960_config =3D { - HDMI_CFG(pwr_reg, 8960), - HDMI_CFG(pwr_clk, 8960), + .pwr_reg_names =3D pwr_reg_names_8960, + .pwr_reg_cnt =3D ARRAY_SIZE(pwr_reg_names_8960), + .pwr_clk_names =3D pwr_clk_names_8960, + .pwr_clk_cnt =3D ARRAY_SIZE(pwr_clk_names_8960), }; =20 static const char *pwr_reg_names_8x74[] =3D {"core-vdda", "core-vcc"}; static const char *pwr_clk_names_8x74[] =3D {"iface", "core", "mdp_core", = "alt_iface"}; =20 static const struct hdmi_platform_config hdmi_tx_8974_config =3D { - HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(pwr_clk, 8x74), + .pwr_reg_names =3D pwr_reg_names_8x74, + .pwr_reg_cnt =3D ARRAY_SIZE(pwr_reg_names_8x74), + .pwr_clk_names =3D pwr_clk_names_8x74, + .pwr_clk_cnt =3D ARRAY_SIZE(pwr_clk_names_8x74), }; =20 /* diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 9bc4bd6761de..1c2e46d38792 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -87,7 +87,7 @@ struct hdmi_platform_config { const char **pwr_reg_names; int pwr_reg_cnt; =20 - /* clks that need to be on for hpd: */ + /* clks that need to be on: */ const char **pwr_clk_names; int pwr_clk_cnt; }; --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f169.google.com (mail-lj1-f169.google.com [209.85.208.169]) (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 BD8C712C528 for ; Sat, 22 Jun 2024 22:02:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093750; cv=none; b=SnLF8vTLGCh4W44ohiebXLxLeglQkq3aEMQ851l7gL0wq3J/N44I/na5OHQN2i1Hv4aYoF/y6SBoQJnw5sVYGOEuAcD6Oyp2vWmGVaI7X0eGR0VQspcK8eW76wnHrJX3Vi6aV9mRaA7bhrTGFduduSBhoIqyMT5Mi0M9XEVXBGQ= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093750; c=relaxed/simple; bh=IKMVsya9o4vBvDRk/2sR0JSKyG59n+7WHe8B9IcbVug=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Uhy0f082e0OsM2pIChYveNWPmalC5J078CeBUavcyI2RE0gejiq2v2OsygXHAwqgqqma2OxLAOePoF1S85Yy9mWaSSlJq6Lr3kkPsMBoLW1TTaP37MvmQd50+8GyLTQOWCkIr+LrVKDC6W+ZTj5LS59LgpNsdz7lCwrRORQtTNI= 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=TkU4oKLV; arc=none smtp.client-ip=209.85.208.169 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="TkU4oKLV" Received: by mail-lj1-f169.google.com with SMTP id 38308e7fff4ca-2ec50d4e46aso15444741fa.1 for ; Sat, 22 Jun 2024 15:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093747; x=1719698547; 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=slg0qL1615VPI0XhTFhgJhcThug3uChho064CYgmjts=; b=TkU4oKLVAX6aOth+I9PJRJNmteKbKltasBFVSNMLK1aLnUGnuJwSU7qxwv+J+ivRRv pZgBz6/zOg9d35hV7+p2hbJEITW7j1wlh17MPGGwR3atPp1trNkh6ADhh/4Lrj79GAiy MKUuscF4is9T9R0ZITCzsW5GoqKK0IgZJIj1mT2C4By+0Ul5nyOnovJjNdDPq8eBfhII GLLgolaxTi1jZYktTllvpuGmNxbk0bCRKdDSeJfXNXPtMW+YGoeiVG7Tghs0M/pZStKo POqc9hJxZS5ybRvgOm9Pe1AQgA05hUcoCh5XJGT+QFywVaMR4Gvu30HEBgwgDCMI9x2i W4pQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093747; x=1719698547; 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=slg0qL1615VPI0XhTFhgJhcThug3uChho064CYgmjts=; b=smvi8WbtDMJLOUqsPK+4Tt3kmdWR3pQT9RZNrh4mpHA65Pn/o66WyOCTrbAHN50uGr kETQPYGBv78EcKk8EJ7gV+nXOiCf5bVU0DuVIQSRfGYyDsda7PciSHmVxA6GMnb+FtWO sabPxr0CAcp/Fzcuau3z9SRrS21Q9tCWiF1zZIMBhqAOw7dBdAXpB3waFErTxtEpqjQJ qrGzJK7M8koGPqxpqxqpjx11rphpqXdkUTWGxXSO9YMYOpa4VmBOj9jqfXc/69fPpgXL zIy+53/+G+vGNZ01UdtB4L5aCZyrmIGDwSuA5OSPPaN/h1bASCLyB3b3qyJ+kgq79xtV +y+w== X-Forwarded-Encrypted: i=1; AJvYcCW6XgTUqN5Zijhph+drJ90HWpP0h95TjZFtQZZ/LP97w4MFy7GCONxkXl0spO2Dw8di/lI5ctrTUAnD/QZIN06XqUjXPs7vjAgKGxs+ X-Gm-Message-State: AOJu0YznQr2aQYXqU5A968TD10s4Su9nJPVG8QLj2MPVUGgTTk0aaZvm hXfnCxaBhd7ZdUFQjjvF2jQq4bb3YlQpbZmZo0XXpRV5RBCfOOfkRSAp+QxouOG/hJrHiUyMidL UcLY= X-Google-Smtp-Source: AGHT+IGlPIj5UFpVQffFP/O71H4/VkTdmWVZVeEYyLy33LbFBbp/GGAmyVjfwBO4mNKfN+aZKytF1w== X-Received: by 2002:a2e:9dd2:0:b0:2ec:1810:e50a with SMTP id 38308e7fff4ca-2ec579c7736mr10820961fa.32.1719093746800; Sat, 22 Jun 2024 15:02:26 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:26 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:24 +0300 Subject: [PATCH v3 11/13] drm/msm/hdmi: drop hpd-gpios support 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: <20240623-fd-hdmi-hpd-v3-11-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4367; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=IKMVsya9o4vBvDRk/2sR0JSKyG59n+7WHe8B9IcbVug=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0npCD6Z1JlEKMd5Xt6fWP/5+MYZxbs0Pns8Z tA3YnXppWKJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6QAKCRCLPIo+Aiko 1TrtB/4ntzjJ9mo6sr4ZpNbnT+nE7xDo1MbRSkh0RHfGqJk18duXSZbmag5HLSZQfjFdnZNmULO TR0lTwPMsirdvHzUlwHY0sSl6Bz0jbVoInwVNzhQ86mo23bgr67ncHJuugx7VYbQmZZ0/nz44OY +CL98Yb4ipuv82HksLGHqe01zIk/wvKjFLKuZylljbZPCpv71Nx8IxMArk1cIPqB4oe28YgDoX5 KdVCRO482mNPGqvuWNDNPFfgVxGbrgrcWwwGV3XqfaWxO7O2V/2WHpsUcfObIf3viYEDqDiK0YM 8xRuiYfmRxEmUZvertIk8Yz9uUtb+z2qeh+4HbanVSlW+7LB X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A Supporting simultaneous check of native HPD and the external GPIO proved to be less stable than just native HPD. Drop the hpd-gpios support, leaving just the native HPD support. In case the native HPD doesn't work the user is urged to switch to specifying the HPD property to the hdmi-connector device. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 14 +++------- drivers/gpu/drm/msm/hdmi/hdmi.h | 2 -- drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 53 +++------------------------------= ---- 3 files changed, 7 insertions(+), 62 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 5ba9a23ef122..97faa7d26cc9 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -443,17 +443,9 @@ static int msm_hdmi_dev_probe(struct platform_device *= pdev) return dev_err_probe(dev, PTR_ERR(hdmi->extp_clk), "failed to get extp clock\n"); =20 - hdmi->hpd_gpiod =3D devm_gpiod_get_optional(&pdev->dev, "hpd", GPIOD_IN); - /* This will catch e.g. -EPROBE_DEFER */ - if (IS_ERR(hdmi->hpd_gpiod)) - return dev_err_probe(dev, PTR_ERR(hdmi->hpd_gpiod), - "failed to get hpd gpio\n"); - - if (!hdmi->hpd_gpiod) - DBG("failed to get HPD gpio"); - - if (hdmi->hpd_gpiod) - gpiod_set_consumer_name(hdmi->hpd_gpiod, "HDMI_HPD"); + if (of_find_property(dev->of_node, "hpd-gpios", NULL) || + of_find_property(dev->of_node, "hpd-gpio", NULL)) + dev_warn(dev, "hpd-gpios is not supported anymore, please migrate to the= hdmi-connector\n"); =20 ret =3D msm_hdmi_get_phy(hdmi); if (ret) { diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 1c2e46d38792..6faf4397ed58 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -52,8 +52,6 @@ struct hdmi { struct clk_bulk_data *pwr_clks; struct clk *extp_clk; =20 - struct gpio_desc *hpd_gpiod; - struct hdmi_phy *phy; struct device *phy_dev; =20 diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index 32e447267e3b..d3353c6148ed 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -69,9 +69,6 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) int ret; unsigned long flags; =20 - if (hdmi->hpd_gpiod) - gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); - ret =3D pm_runtime_resume_and_get(dev); if (ret) return ret; @@ -144,8 +141,11 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) } } =20 -static enum drm_connector_status detect_reg(struct hdmi *hdmi) +enum drm_connector_status msm_hdmi_bridge_detect( + struct drm_bridge *bridge) { + struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); + struct hdmi *hdmi =3D hdmi_bridge->hdmi; uint32_t hpd_int_status =3D 0; int ret; =20 @@ -161,48 +161,3 @@ static enum drm_connector_status detect_reg(struct hdm= i *hdmi) return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED) ? connector_status_connected : connector_status_disconnected; } - -#define HPD_GPIO_INDEX 2 -static enum drm_connector_status detect_gpio(struct hdmi *hdmi) -{ - return gpiod_get_value(hdmi->hpd_gpiod) ? - connector_status_connected : - connector_status_disconnected; -} - -enum drm_connector_status msm_hdmi_bridge_detect( - struct drm_bridge *bridge) -{ - struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); - struct hdmi *hdmi =3D hdmi_bridge->hdmi; - enum drm_connector_status stat_gpio, stat_reg; - int retry =3D 20; - - /* - * some platforms may not have hpd gpio. Rely only on the status - * provided by REG_HDMI_HPD_INT_STATUS in this case. - */ - if (!hdmi->hpd_gpiod) - return detect_reg(hdmi); - - do { - stat_gpio =3D detect_gpio(hdmi); - stat_reg =3D detect_reg(hdmi); - - if (stat_gpio =3D=3D stat_reg) - break; - - mdelay(10); - } while (--retry); - - /* the status we get from reading gpio seems to be more reliable, - * so trust that one the most if we didn't manage to get hdmi and - * gpio status to agree: - */ - if (stat_gpio !=3D stat_reg) { - DBG("HDMI_HPD_INT_STATUS tells us: %d", stat_reg); - DBG("hpd gpio tells us: %d", stat_gpio); - } - - return stat_gpio; -} --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f182.google.com (mail-lj1-f182.google.com [209.85.208.182]) (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 1F62312C81F for ; Sat, 22 Jun 2024 22:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.182 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093753; cv=none; b=UG6sknyydGxrjOMrC/8gvZtmtygvm+AOLvpv9yH+7ofNBp4gBLy9D6cbL8lIdbOgLcjtznwpuosFNIkJCtMufZow6Mx/QabUguhXgzQewEuT+Vx5yJsKcYra7Tjj7b8jKIFsXj+SxWH3UjH7g1E0FBq7KbPNBhbYY5rAaUAkRe0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093753; c=relaxed/simple; bh=e9w+F4AfC0WhIbmyBrInkYJ4EpCvrEa584Hzzbn41wE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=Eu3MfNw+IDuPxPx79hZVSgYFmCnjT6Y3A1vyBHPk9vzLixfHey0lKqpVZ56C9yfAAlrCRg6L0rYLZTzS21jp0LXHz1x+laIGILascbCA3ErxdaXAlX5hlSKSKL/iwpXtkZl09k4fgLgA0fWYNNzXZj1TmsW0Vop2LD+vlnvtlEw= 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=q3Hjbvol; arc=none smtp.client-ip=209.85.208.182 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="q3Hjbvol" Received: by mail-lj1-f182.google.com with SMTP id 38308e7fff4ca-2eabd22d3f4so38421221fa.1 for ; Sat, 22 Jun 2024 15:02:28 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093747; x=1719698547; 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=Yx+JI017WinXbQ5IxwQW21eqYtv0eFPwBD3pRx15tvM=; b=q3HjbvolvIXEzGgvTvWmep0j/g/yC+N9EyCqCg64syFefTu1Gw285g2uUhG7pTF+ew PkbcWhHeuPwzRySxj6KyqA5LF8uuD6mD+7H6wPjP/2q0oFThSffwMPvGiCHv3XS5EgB3 BZ8ZWlapixqY84Hw5MHF0y4X221lttnmyk1oVn1IpaL+ZwitXjqP5tRbNhIt++YggUzV WkrWtxG/gRp7t5n3z0MX1HrUqQmr3NRfcV/Ux8fWYyvv+9kxmbEJS40vZEDtBNSioKPE jAzuc2332RSANfyL+u2WMnUSkZ5AhqoJIP0yHtvstRuJk027N5s/p5cc9kcJzW6Zlc9Q Ii+w== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093747; x=1719698547; 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=Yx+JI017WinXbQ5IxwQW21eqYtv0eFPwBD3pRx15tvM=; b=JqkHXncqWTUxNo1X31ZAc21IA+Zlib8ICBdpgYbiDsQVLl030N+7+zaMi2tgTDPb6y 2wJX/OBN0vnrtYVZWndY4qp0CT7exlr9I6NJqbvZPOyJErhwJx56429lRdIn51ojszd4 ohoApGuxQZXXRvwQ5Hn6y2RM9c+BOXzHKT7nGfky+qKsxzxoJc7wSRpQaoNalXqjmRQ7 gKtIhVAIu4M/DNel2CJltuPEkOWc/wz+zBgXdm3WfCK29+ZbbBc3NyAXqV26OxOIt+xB rcfLR/mhsOJulNaXx67Pp1ChCHXjYHnsqoAa5RoA02lSpMLk4tWnUG8r1TuAcTGPadgt 9jbQ== X-Forwarded-Encrypted: i=1; AJvYcCWsI6zkajbaL13INDcR1Vx46LHYkKmdMpBOMiaabCnV/keJMSQgPX+aKqmKsU3AXq5/F26jaimd7EkE90GFDFdTbbTYJFIS3tLDS4ef X-Gm-Message-State: AOJu0YyoPvpxEgtR5VhTZdpND0JtWyTxdQZdw+1Xn+L2upkJ7q2pMKtD AMJEeG1tHk6APXldO+MPNWhX2cSlDjNy8mggiP/OGUblCQ2Abqn1svC1GjicvO8= X-Google-Smtp-Source: AGHT+IECgjKIiTyRvwZJCRLLvKjR/DBRsJBoyU/RXQ90jopy3B6oRVzRtd9sHMtVwYMsadrxrC4ibw== X-Received: by 2002:a2e:8011:0:b0:2ec:165a:2254 with SMTP id 38308e7fff4ca-2ec5b3077c0mr3541661fa.44.1719093747447; Sat, 22 Jun 2024 15:02:27 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:27 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:25 +0300 Subject: [PATCH v3 12/13] drm/msm/hdmi: ensure that HDMI is up if HPD is requested 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: <20240623-fd-hdmi-hpd-v3-12-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3766; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=e9w+F4AfC0WhIbmyBrInkYJ4EpCvrEa584Hzzbn41wE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0npUzi13UHgxCGRdtwhPdIm+QR0wlzt4HJH8 X2QpYkRZPaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6QAKCRCLPIo+Aiko 1XSlB/9FpKQBBnW2K+qy6NxMi02ycBFGVFlHaocEuj+Vwulnc7iQESd4/vrNdFCM9Mfh9JRn3KC RnAhzomMC/CgLbFo24+HPl+F5Gvd1MhOMOGxRWPE9T/sprrNdfSlldUUuT2PuZh0IPrWuMb+Jtx 3kE/nDwH8wBRnSeEfKqvXLEn6QTUWwFX9tc2N3AXPnKogBzBGbpurwUMzK03FniUjJmCPC5Myla vC+avuJGU9G0mwXJrBr1AWVxuquUVoYZL8wbOMXxi6X5sTunbmFkHmY0Bnp9C/tH0lQqPg2gsB2 skILo/o85KvqLKQJHMCTjPQ1vCKyYCv+PPF0WRxGtcRSj95O X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The HDMI block needs to be enabled to properly generate HPD events. Make sure it is not turned off in the disable paths if HPD delivery is enabled. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 1 + drivers/gpu/drm/msm/hdmi/hdmi.h | 2 ++ drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 8 +++++++- drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 9 ++++++++- 4 files changed, 18 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 97faa7d26cc9..9f1de4c9ffdf 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -384,6 +384,7 @@ static int msm_hdmi_dev_probe(struct platform_device *p= dev) hdmi->pdev =3D pdev; hdmi->config =3D config; spin_lock_init(&hdmi->reg_lock); + mutex_init(&hdmi->state_mutex); =20 ret =3D drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi-= >next_bridge); if (ret && ret !=3D -ENODEV) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 6faf4397ed58..9961dae9e9b3 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -42,6 +42,8 @@ struct hdmi { =20 /* video state: */ bool power_on; + bool hpd_enabled; + struct mutex state_mutex; /* protects two booleans */ unsigned long int pixclock; =20 void __iomem *mmio; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index c15c49c08d30..7bf1c3b379c1 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -308,11 +308,13 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct = drm_bridge *bridge, =20 hdmi->pixclock =3D conn_state->hdmi.tmds_char_rate; =20 + mutex_lock(&hdmi->state_mutex); if (!hdmi->power_on) { msm_hdmi_phy_resource_enable(phy); msm_hdmi_power_on(bridge); hdmi->power_on =3D true; } + mutex_unlock(&hdmi->state_mutex); =20 drm_atomic_helper_connector_hdmi_update_infoframes(connector, state); =20 @@ -337,7 +339,10 @@ static void msm_hdmi_bridge_atomic_post_disable(struct= drm_bridge *bridge, msm_hdmi_hdcp_off(hdmi->hdcp_ctrl); =20 DBG("power down"); - msm_hdmi_set_mode(hdmi, false); + + /* Keep the HDMI enabled if the HPD is enabled */ + mutex_lock(&hdmi->state_mutex); + msm_hdmi_set_mode(hdmi, hdmi->hpd_enabled); =20 msm_hdmi_phy_powerdown(phy); =20 @@ -346,6 +351,7 @@ static void msm_hdmi_bridge_atomic_post_disable(struct = drm_bridge *bridge, hdmi->power_on =3D false; msm_hdmi_phy_resource_disable(phy); } + mutex_unlock(&hdmi->state_mutex); } =20 static void msm_hdmi_bridge_atomic_set_timings(struct hdmi *hdmi, diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index d3353c6148ed..cb89e9e2c6ea 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -73,10 +73,14 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) if (ret) return ret; =20 + mutex_lock(&hdmi->state_mutex); msm_hdmi_set_mode(hdmi, false); msm_hdmi_phy_reset(hdmi); msm_hdmi_set_mode(hdmi, true); =20 + hdmi->hpd_enabled =3D true; + mutex_unlock(&hdmi->state_mutex); + hdmi_write(hdmi, REG_HDMI_USEC_REFTIMER, 0x0001001b); =20 /* enable HPD events: */ @@ -106,7 +110,10 @@ void msm_hdmi_hpd_disable(struct hdmi *hdmi) /* Disable HPD interrupt */ hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, 0); =20 - msm_hdmi_set_mode(hdmi, false); + mutex_lock(&hdmi->state_mutex); + hdmi->hpd_enabled =3D false; + msm_hdmi_set_mode(hdmi, hdmi->power_on); + mutex_unlock(&hdmi->state_mutex); =20 pm_runtime_put(dev); } --=20 2.39.2 From nobody Wed Dec 17 12:18:37 2025 Received: from mail-lj1-f179.google.com (mail-lj1-f179.google.com [209.85.208.179]) (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 E75E112D755 for ; Sat, 22 Jun 2024 22:02:29 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093751; cv=none; b=fbUdqWvulLqc39IJDcK+fNFC8Rx2Sp6u+5TxcC8FvEi11o+X8j2HaYz5L1VJM4o/xab3wqUia2kS0c3zTMdHLdFywimc3rPQHa55+v75q8nYe0suvA4dzniLFqGIaIsrg0p56jNNrCdXa+AVhOlhh3vgHQn1f/+Ynmnlwa9l4zA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1719093751; c=relaxed/simple; bh=+t2U1RD/wb4G84+CRNoOtMFGJ3kapYkKIPOtVroW3X8=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=hMCApLAZhDJ5FbK4vhTPppvvGv3dfgIS4XERf8vGcJXElqvdz8UURsxvA8TwangkXAzY0vspY5U7wOJWhzrG4Ww2IhLK0hsKj2LnXxxTH3CHTQ0ga/HMWtbhkzvuoLJS0THKnShB5wwk6vfAVqU5xN5gTdOpT7Vn7SjVYDLWfxQ= 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=zigctDxs; arc=none smtp.client-ip=209.85.208.179 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="zigctDxs" Received: by mail-lj1-f179.google.com with SMTP id 38308e7fff4ca-2ec52fbb50bso11500031fa.2 for ; Sat, 22 Jun 2024 15:02:29 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1719093748; x=1719698548; 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=PGHdc8YiA3WTHk5P8vKAyvQjRr5JX9fvWorT4SZVW8k=; b=zigctDxsFgeSbB5UVq2zYFm3pb9XYa6GeO8NIgjOqaBmDW/vyZD8Q6wE/nbZ+QgFGP pbi5PiEusWKY11mzE4ZLnkxethyB5idx4ppCJsUnnkGcNMFXufeqxA9JCCp+EPV9gVMH ZW0wlg84JG4wm+adgCqLOofo/3m1AVguyr7Xz6dcwh5BMIpIqWIitZqSUNUg9J/uf8DW DjJWfArULztuBJcz9RdnUyggOpfR3MGAqil1r6YUN9TddYQp4Az/JhOojzEeRWvOGNH9 G4VOCpllbSpZfN/i7Q7pIoF8Qo9dB/GmwPpiwKMmFqD7feBDXWr0HETH8ztOom1gGj+u Bt0g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1719093748; x=1719698548; 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=PGHdc8YiA3WTHk5P8vKAyvQjRr5JX9fvWorT4SZVW8k=; b=KeHfau6auoWgWn+M5Vzp3qISNrrQ8FVEeW2VPC3aiTzJPl2ZIVxGfI6d/sd4hj8hPF lpN8CiAS3R7cN7CTzCBUnWmyTobQTxNgcHa7NXK6d32bavPW7ZNOnkWgmUigEXNwmV5r dhHEvOZOV4VBCjLOophYBe126Y8eeEMx6JsuDlnMVMkk9GighjBRthwL8GN/5wWsdIkL B3PYngLNf49PSSBEnM5rC6AS8aF34PzG0x2GI1J7DhAXNqpx0+N1HBGB5OL2ITvj9OEy LoGSapuuXMnU1LHPApHlfhurvMcHlW/Ildk2sh2HxLzt/0ChAQMknc4yunLLVcT/bVRm ox3g== X-Forwarded-Encrypted: i=1; AJvYcCVqE4yNF4PpDS4kMzqHVzkGWbIaXjn1BBCSzKmAEg1z4vTG0PMV5a9Z2VLI9HurR0p19rjL7e7djI0+mUrHJCZVf5c+nNtO9vi+zYyC X-Gm-Message-State: AOJu0Yz60sqzR4RxigEWCvg1sSihcBJcBWFbQxghe23Rjk5dLDJiIj6P prF6jaT/oIc1jASvm9SPJQlSq5boBLbYlXgu95xdAxvbPgcd0gx4wD3lQqHkTcI= X-Google-Smtp-Source: AGHT+IFdNEvT/KXwtp6byJyVArrLJT0q2zVKjTyW+suLZeO+39QYIbtNWDX5qi9Reqa4HCGgijjkUg== X-Received: by 2002:a2e:9596:0:b0:2ec:1dfc:45bf with SMTP id 38308e7fff4ca-2ec5b3d496emr4164051fa.42.1719093748156; Sat, 22 Jun 2024 15:02:28 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 38308e7fff4ca-2ec55e56ea5sm2502051fa.112.2024.06.22.15.02.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 22 Jun 2024 15:02:27 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 23 Jun 2024 01:02:26 +0300 Subject: [PATCH v3 13/13] drm/msm/hdmi: wire in hpd_enable/hpd_disable bridge ops 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: <20240623-fd-hdmi-hpd-v3-13-8645a64cbd63@linaro.org> References: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> In-Reply-To: <20240623-fd-hdmi-hpd-v3-0-8645a64cbd63@linaro.org> To: Rob Clark , Abhinav Kumar , Sean Paul , Marijn Suijten , David Airlie , Daniel Vetter Cc: linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org, Jessica Zhang X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=4028; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+t2U1RD/wb4G84+CRNoOtMFGJ3kapYkKIPOtVroW3X8=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmd0nquPw6MxmqYJ+vfPQc/Atbn/P9DAqJmmFQt Yr+/Lkja2qJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZndJ6gAKCRCLPIo+Aiko 1WRqB/0efKfu2G2+t6qny4TOcmCSPhfPu7OOFom+3b421qfQbFXUny/DZ0W1AA8kEu/gH1pBcKb /Gws4qXxf9719+rG6htWlLc6pDbh2X5GSLl+Gw2LdNgSGOlsBPgcb+rAULRVP0tinf9SC1kJFsF 238GTjIRY666bROxfOHEnjuzpRj+zLo9Wfdk48mySvgxvQuN4qBUCwFWTLAQA/a5H3UqbbeyGp6 04u6qOgMk1JiEGG1tlW8bE9zQ+KEku0p6WGCKqKEnt0ooO3l0WjtDshGualV6i2ay5P0U82l+Jp odceYaWBvcqku8OEIZPpnxkiwVAbXMF76xQQMvqutiryQ8Zo X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A The HDMI driver already has msm_hdmi_hpd_enable() and msm_hdmi_hpd_disable() functions. Wire them into the msm_hdmi_bridge_funcs, so that HPD can be enabled and disabled dynamically rather than always having HPD events generation enabled. Reviewed-by: Jessica Zhang Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi.c | 9 --------- drivers/gpu/drm/msm/hdmi/hdmi.h | 4 ++-- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 4 ++++ drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 12 ++++++------ 4 files changed, 12 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdm= i.c index 9f1de4c9ffdf..7621d17b57b8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -201,12 +201,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, goto fail; } =20 - ret =3D msm_hdmi_hpd_enable(hdmi->bridge); - if (ret < 0) { - DRM_DEV_ERROR(&hdmi->pdev->dev, "failed to enable HPD: %d\n", ret); - goto fail; - } - return 0; =20 fail: @@ -352,9 +346,6 @@ static void msm_hdmi_unbind(struct device *dev, struct = device *master, if (priv->hdmi->audio_pdev) platform_device_unregister(priv->hdmi->audio_pdev); =20 - if (priv->hdmi->bridge) - msm_hdmi_hpd_disable(priv->hdmi); - msm_hdmi_destroy(priv->hdmi); priv->hdmi =3D NULL; } diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdm= i.h index 9961dae9e9b3..96f2a982c766 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -207,8 +207,8 @@ int msm_hdmi_bridge_init(struct hdmi *hdmi); void msm_hdmi_hpd_irq(struct drm_bridge *bridge); enum drm_connector_status msm_hdmi_bridge_detect( struct drm_bridge *bridge); -int msm_hdmi_hpd_enable(struct drm_bridge *bridge); -void msm_hdmi_hpd_disable(struct hdmi *hdmi); +void msm_hdmi_hpd_enable(struct drm_bridge *bridge); +void msm_hdmi_hpd_disable(struct drm_bridge *bridge); =20 /* * i2c adapter for ddc: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/h= dmi/hdmi_bridge.c index 7bf1c3b379c1..0441d728afc8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -465,6 +465,10 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_f= uncs =3D { .mode_valid =3D msm_hdmi_bridge_mode_valid, .edid_read =3D msm_hdmi_bridge_edid_read, .detect =3D msm_hdmi_bridge_detect, + + .hpd_enable =3D msm_hdmi_hpd_enable, + .hpd_disable =3D msm_hdmi_hpd_disable, + .hdmi_clear_infoframe =3D msm_hdmi_bridge_clear_infoframe, .hdmi_write_infoframe =3D msm_hdmi_bridge_write_infoframe, }; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c b/drivers/gpu/drm/msm/hdmi= /hdmi_hpd.c index cb89e9e2c6ea..04d00b6f36fd 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_hpd.c @@ -60,7 +60,7 @@ static void msm_hdmi_phy_reset(struct hdmi *hdmi) } } =20 -int msm_hdmi_hpd_enable(struct drm_bridge *bridge) +void msm_hdmi_hpd_enable(struct drm_bridge *bridge) { struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); struct hdmi *hdmi =3D hdmi_bridge->hdmi; @@ -70,8 +70,8 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) unsigned long flags; =20 ret =3D pm_runtime_resume_and_get(dev); - if (ret) - return ret; + if (WARN_ON(ret)) + return; =20 mutex_lock(&hdmi->state_mutex); msm_hdmi_set_mode(hdmi, false); @@ -99,12 +99,12 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) hdmi_write(hdmi, REG_HDMI_HPD_CTRL, HDMI_HPD_CTRL_ENABLE | hpd_ctrl); spin_unlock_irqrestore(&hdmi->reg_lock, flags); - - return 0; } =20 -void msm_hdmi_hpd_disable(struct hdmi *hdmi) +void msm_hdmi_hpd_disable(struct drm_bridge *bridge) { + struct hdmi_bridge *hdmi_bridge =3D to_hdmi_bridge(bridge); + struct hdmi *hdmi =3D hdmi_bridge->hdmi; struct device *dev =3D &hdmi->pdev->dev; =20 /* Disable HPD interrupt */ --=20 2.39.2