From patchwork Wed May 22 10:50:53 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670758 Received: from mail-lf1-f50.google.com (mail-lf1-f50.google.com [209.85.167.50]) (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 DDA7681ADA for ; Wed, 22 May 2024 10:51:00 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.50 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375065; cv=none; b=om3O2YIPvKR/dsftkWc5I6/R0ID2AfUwoEOFyyDfxoMINc6Gv03FHCgS6zGklrToyzx3Eluvz97xr3XEb+M0HuVmwRWLjdmljq3TsDqmMMfxcukRImNZU8lmcVNnTO+4X0V2SFAi9ClmtSoFud7WMp0rRou56foYreohVZR/Wc8= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375065; c=relaxed/simple; bh=GHqYh/OpnADzbIGNQTWljjAqbsvOTUqyL6NzDNpzFls=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=dCtwVDMlZ/h7dRRcDk35JThmrTW6ohz5lhZacr5JlgTEJfAdKpQV0jm1qfEHOjWLwGTGn7ysCe8DNELVTeO2MNb4T0T1Cuyhf4djO+CebYzktnDecWX88ejurpO5tlLwWbO80Gm8rzMq3wY7O8GgE0KjOJluW36dCp2sPO8rCY4= 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=QTCcRXrD; arc=none smtp.client-ip=209.85.167.50 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="QTCcRXrD" Received: by mail-lf1-f50.google.com with SMTP id 2adb3069b0e04-51f4d2676d1so6246411e87.3 for ; Wed, 22 May 2024 03:51:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375059; x=1716979859; 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=03lZtK/lY1XEVDdKgvI8NPNMNTf3HunLZingl7OzXps=; b=QTCcRXrDWWkAGiBd93rSVTXvPVTdcRUsUwkBju4f5q6NldPXSpJerIOvr3ma4lAgD6 8EVeyoI8Fiw9mLltCiJMsYkwrGNgysJssKHmn0oiKxE6kJ6dWNMF/+8AC75vA2NfXc7Y 6VWC3Sr9ZtUiTDIRnMdRXQMV8ZoMteQwyQhbGibglXeZIDI703bnVLAO82+XWiG3kWHq N5ccLY3FGL6/FcY4CbJ3ubz0cmLe9T4c3yAz51vCZFAeNh+nFYLsMhvzNerpwylLy/NH 7mKMlrKiC5NznviCOwa6XBs0BrGN4w4CpLEat6VhtN9M4lXU5kSuW1BOJN5BsWV298lr JIEQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375059; x=1716979859; 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=03lZtK/lY1XEVDdKgvI8NPNMNTf3HunLZingl7OzXps=; b=BV00+BQ6PxTRBY6GndixFi0Myz449v8+0gxoeV33evvbSTjN5h8eJZV+h7NasrP8nz 4ONksX5InYSg2/3P+gx3ygjHlQKDKutwVKFP+y2eiCRGPpct389LED0Tyh6YdGWyqyUj mTn00PWjX2wAHldNSlZI3sE/uZ5+X77ohCHT1Qp0r8x1Nf2+0ICdk7clJ1OZ8/3Q0mA2 36wfzdDHWhEiShuqycByusA9JgMMtyjbcRFzQdBKAcJcTzxWd2dKewzviau9bMx+kuFG +QdLGE8uIDNVOJvsFtU8E92kzE6sqVHjThsInVFyZ1guiZ5dGtMnDfj07nAaWu/H+gR5 BQdQ== X-Gm-Message-State: AOJu0YyqAuGAu2R7ouC8tFDOfT+/wtqVKgXOw5/4K7nkC2uUgNUMxjVA G5ATmscHjEuZ1lZSHaVuvW5rJeOyyNzHr09pvvf6ilTJTxmhH63hocdYcr7LSM4= X-Google-Smtp-Source: AGHT+IFjZBlFB63a+RCudEv/MwFQ9Q2bCole0thkPnhyzMY0Oy8BRRlACoKsAdrqd0TOgwhv6ucLQQ== X-Received: by 2002:a19:ca05:0:b0:51d:8159:598 with SMTP id 2adb3069b0e04-526bf35cb35mr855189e87.19.1716375058977; Wed, 22 May 2024 03:50:58 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.50.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:50:58 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:53 +0300 Subject: [PATCH v2 01/14] drm/msm/hdmi: move the alt_iface clock to the hpd list Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-1-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=1311; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=GHqYh/OpnADzbIGNQTWljjAqbsvOTUqyL6NzDNpzFls=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4P+BDWacbqmwW114/XMonajf8PabUyuJ9lv 2ys/6u9ObSJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3ODwAKCRCLPIo+Aiko 1e3eB/9uYYVb14/WnhhBPj+AyebWjWRnP0iG8FjY7dT+zHqyaHXAWZqh22kKOrvTdAFImY8ih1Z Lgk5naB5PAau9KARHCmo4xvSVORJHkEmzse2OCD3YJpxoS/3fZb9pqaQabxdi6zrbj2t6rksnwi vtvaSz0tlomAzHIpdZIAxeU6XnxshDfgfnf+44edFQ29Tb658R4vIir+ysKkGeI1qTta+6HQUlB EUZc/mqgBdxzKfBc0YlF+Xz0SayBG8YJC0DtMpEDdBJ4uZjmR45AZ7ihrMm57eZ5P1bkEoS4Chs 91rAubNr/uUXsHn4+bZ3HmPH4dnNKqIfyMAvTS3WyHxqrxzv 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/e07a5487e521e57f76083c0a6e2f995414ac6d03 Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index 24abcb7254cc..108c86925780 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -235,9 +235,9 @@ static const struct hdmi_platform_config hdmi_tx_8960_config = { }; static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"}; -static const char *pwr_clk_names_8x74[] = {"extp", "alt_iface"}; -static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core"}; -static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0}; +static const char *pwr_clk_names_8x74[] = {"extp"}; +static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; +static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0, 0}; static const struct hdmi_platform_config hdmi_tx_8974_config = { HDMI_CFG(pwr_reg, 8x74), From patchwork Wed May 22 10:50:54 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670757 Received: from mail-lf1-f48.google.com (mail-lf1-f48.google.com [209.85.167.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A6203823AF for ; Wed, 22 May 2024 10:51:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.48 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375064; cv=none; b=nfCDjTBkBAfDxxcYEigxH0SUOUICLb7Mot/4HjNFnom3N8cTmjpMiFwL7kkO2NET7cAgqsTf9l1+PJzii14jYU/xWBilXTiw49HDcA/OcJfN1fX2KsjW1RoDig4m2aUiOMK4ECAwVDHYA2rNdNk+V+O5VPBQoq4AUvV++S+w04E= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375064; c=relaxed/simple; bh=OqWVWP2+AiuB0eZmmX6BVNibFfmd2vfn14lHJu5N/wM=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=EZP4EzvDEnC/wSbKPXcbY97e8plGIszNmZwBEfwwWTERvZk+yzuBQrBg4sB5+UG2AK1HkYo89C4WrF0HlYZPlEM1nL1PLuLf43UTWvISZka5KoDRtT7jVxSNyr9A77Xm71MRkVL5AD58iY+kchmv7t38V9m+0drqsVTKYZ03cPI= 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=FzTmBHlb; arc=none smtp.client-ip=209.85.167.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FzTmBHlb" Received: by mail-lf1-f48.google.com with SMTP id 2adb3069b0e04-51f1e8eaee5so594819e87.1 for ; Wed, 22 May 2024 03:51:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375060; x=1716979860; 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=/4mDJNdY3BQpBxyPjIYj4R7zW531FPYbhtqPnKZkd9k=; b=FzTmBHlbI7SCG6DBYSgSZOeSU5MydeR8v8gXwlNBPhwp3ejtxVDYaLjBLgKBoIj34Z ADL8DcMc96KeRG5W8kEnV2pnShpNr0IPRUtcb5fvWozTwZEyENqpwiPijqTsf8M6ucIb zrblhDwyybFd6jtG2bVzC2TYuHGAjjmBwWwQc5ET5mc48TrjeXClDDdQGCqIQTe6l59r hohVDd6Pyb+6d1ujUKdXzKlrLZGuR8O03TFxssm8FjIlB9XKG4z4u7YNsfdtb0gxzQgq MHbSK15SWyLrGSlFb95sSM0XPCPZfQPm8uG4pEsIPk/M5eZrh8l8DFmRDtZciKzvE8m1 3Y+Q== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375060; x=1716979860; 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=/4mDJNdY3BQpBxyPjIYj4R7zW531FPYbhtqPnKZkd9k=; b=KeK7qVTiiJbL+nL0wGgYF7qbUwaNYqvTxwMtudtgp5dQWrgwmg/e322FKRDUheRQm+ CQnwqqYrj/mdxDRy1hlS/UlQL3EwgF5XniFBVUh+urw9W6nM/XkLdrZZ2i6udo/zyr/z rz0xsX6fm5isrqeAi9fkfJkWUYKXfRX7xI0mQftrkN8pPd3zrJU5MyRK1MXev4Kkg7LS Km8KaG6EOtZ5yS2fxsn1OZqtB3sN+rYJSRHnZa8g2Wirr7eXNnVzBwXZScee3Anpall9 IaRa5btH3zIJfnlYWmhj1JIBCEwmtiU6kh4nzMIx8amZ0ZAG7a3+D3i0gRBN3Epa0Z3K f9aQ== X-Gm-Message-State: AOJu0YzJ+xJPreeEt9kK909R0iK/XNBETVXhhvddeNLc9NLo2gyNz4Qs vgh0h8hqwL/0GNR7o4jEz3kuldNKm2/DjiI8SnzOfacm1O3FaBVrve7IY3eVMCo= X-Google-Smtp-Source: AGHT+IEYXIMyl3eSxKpjBCG9L21f/R2Dl2+wh1OnVS2XyqdyNDi1cNFgpQEiZv9NXyXWYkFmbpjYuw== X-Received: by 2002:ac2:46ef:0:b0:51c:b0c9:ea54 with SMTP id 2adb3069b0e04-5269b8a9c36mr552508e87.16.1716375059959; Wed, 22 May 2024 03:50:59 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.50.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:50:59 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:54 +0300 Subject: [PATCH v2 02/14] drm/msm/hdmi: simplify extp clock handling Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-2-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=5848; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=OqWVWP2+AiuB0eZmmX6BVNibFfmd2vfn14lHJu5N/wM=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4PbIhSU16AXMkzZZcytwIW6PZ12zsiXOYod IBQ5PyaSMeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3ODwAKCRCLPIo+Aiko 1V5oB/4mjXL6dJ/5q/obF0HXfl/AQP265nycil27dxSNjaftozZH2WVndqjQxfgl0S3O+7/ZsZU dUZAtqu3NwlHnTM7EnM7Rf83GjyVCwnO7hfPmNpvrAO564o7qkvDYb7MDyf1Q3hx3fIxvIdLG1D JLr0ZZtuxuKmeu42xCpfS7rTYlkNuONeVlxv26khJL9CzDdf3mcr8a5lMGOrcobOrh69+fhzQD1 bWR/pzkkecsKvpDADa5Bz7rsfXaG+6RrahLWIA8DdOrV9spB5gdkj0SRJuJggDRbfdnRMqDhLw1 +O2y7rVVBQzartquDNj5r4b5x47nugrv7XF8NBMjjXKRhn43 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index 108c86925780..681265e29aa0 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -235,13 +235,11 @@ static const struct hdmi_platform_config hdmi_tx_8960_config = { }; static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"}; -static const char *pwr_clk_names_8x74[] = {"extp"}; static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0, 0}; static const struct hdmi_platform_config hdmi_tx_8974_config = { HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(pwr_clk, 8x74), HDMI_CFG(hpd_clk, 8x74), .hpd_freq = hpd_clk_freq_8x74, }; @@ -485,24 +483,10 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) hdmi->hpd_clks[i] = clk; } - hdmi->pwr_clks = devm_kcalloc(&pdev->dev, - config->pwr_clk_cnt, - sizeof(hdmi->pwr_clks[0]), - GFP_KERNEL); - if (!hdmi->pwr_clks) - return -ENOMEM; - - for (i = 0; i < config->pwr_clk_cnt; i++) { - struct clk *clk; - - clk = 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] = clk; - } + hdmi->extp_clk = 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"); hdmi->hpd_gpiod = 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/hdmi.h index 4586baf36415..abdbe4779cf9 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; struct gpio_desc *hpd_gpiod; @@ -98,10 +98,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; }; struct hdmi_bridge { diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 4a5b5112227f..9eb4d06bdc0e 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -17,7 +17,7 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; const struct hdmi_platform_config *config = hdmi->config; - int i, ret; + int ret; pm_runtime_get_sync(&hdmi->pdev->dev); @@ -25,21 +25,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); - if (config->pwr_clk_cnt > 0) { + if (hdmi->extp_clk) { DBG("pixclock: %lu", hdmi->pixclock); - ret = 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 = clk_set_rate(hdmi->extp_clk, hdmi->pixclock); + if (ret) + DRM_DEV_ERROR(dev->dev, "failed to set extp clk rate: %d\n", ret); - for (i = 0; i < config->pwr_clk_cnt; i++) { - ret = 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 = clk_prepare_enable(hdmi->extp_clk); + if (ret) + DRM_DEV_ERROR(dev->dev, "failed to enable extp clk: %d\n", ret); } } @@ -49,15 +43,15 @@ static void power_off(struct drm_bridge *bridge) struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; const struct hdmi_platform_config *config = hdmi->config; - int i, ret; + int ret; /* TODO do we need to wait for final vblank somewhere before * cutting the clocks? */ mdelay(16 + 4); - for (i = 0; i < config->pwr_clk_cnt; i++) - clk_disable_unprepare(hdmi->pwr_clks[i]); + if (hdmi->extp_clk) + clk_disable_unprepare(hdmi->extp_clk); ret = regulator_bulk_disable(config->pwr_reg_cnt, hdmi->pwr_regs); if (ret) @@ -271,7 +265,6 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; - const struct hdmi_platform_config *config = hdmi->config; struct msm_drm_private *priv = bridge->dev->dev_private; struct msm_kms *kms = priv->kms; long actual, requested; @@ -285,8 +278,8 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge if (kms->funcs->round_pixclk) actual = kms->funcs->round_pixclk(kms, requested, hdmi_bridge->hdmi->encoder); - else if (config->pwr_clk_cnt > 0) - actual = clk_round_rate(hdmi->pwr_clks[0], requested); + else if (hdmi->extp_clk) + actual = clk_round_rate(hdmi->extp_clk, requested); else actual = requested; From patchwork Wed May 22 10:50:55 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670759 Received: from mail-lf1-f45.google.com (mail-lf1-f45.google.com [209.85.167.45]) (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 4B6DE82491 for ; Wed, 22 May 2024 10:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.45 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375065; cv=none; b=ivgb0d8UX8ooOY0AsSQzNVipSscqWPVg0xGLAj4Zl+W9htc2wn2CrIBEGxkDq84UERzszDq/Z3gttZMH4H30Z5NwWmU4DIcUWQot+/dBtnV8/dGvGPCgdpkzWFuS/82lX/o0f4ix9D5xRs8yJtK6p4tpa2jjh6d3HKzEf28xTn4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375065; c=relaxed/simple; bh=osqs9uVQGma2pB7Uqqmi191XkOj9NO2HEt9nbTjIsVU=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=gJbfgDbHj4ZaTcyEYAsBPiIpk804tpfKyzNhar+O8ceX5vkv4FWTEAXYVTCQ9GbyngaSrAHAMYZ/GCxnANfrjm36+rMhWU8fkE1DjbAAuaEw411dmqwD/gWpVCcg9GFpCGm7lW7eQn5i77Mqwji+f0UaD4m5QJKKtL93M2GRl58= 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=TjNkqHKI; arc=none smtp.client-ip=209.85.167.45 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="TjNkqHKI" Received: by mail-lf1-f45.google.com with SMTP id 2adb3069b0e04-51f40b5e059so6899520e87.0 for ; Wed, 22 May 2024 03:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375060; x=1716979860; 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=9dResiOVnD3KDBKBragxWJ8JzwAGCkXgZAm144m2F5c=; b=TjNkqHKIdYxxWe4LEmJ4nirZAc8wdlcMp/EIEPugcFw18uo8hykEaqzHc6Of5TEfeO 79JcefWoluPbRVUbJOglmYTXbZHK273twte6kDaFWa9HVN7/w8YFlw+O+r1R7otjXaos W6RotYZJRxz4SxXrO/ZdkFSedhT24T+IdImGOmqCByJ1ssxBOeOomSlY8VFuEekLalP4 FYsSXuYdU/Vowx2HZx1mCw13evMhQHSwpyHI013Ux1o0FJwuyRgEWs0SK0TiJ41pzVs/ RvybGeFXC3xcjjbogfVQcPRL2FYfp3Djekbi8k+w/yVxfrO/LruqNkuUnNP17l7Bo7O0 V2fg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375060; x=1716979860; 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=9dResiOVnD3KDBKBragxWJ8JzwAGCkXgZAm144m2F5c=; b=RyuN5X0Gc2X53xO38yD9kIXdZO1GjZoFtw/FslAVDJmrEvfmJXfjbJKW6APSysA/Ma RODJcxxpFs4zn0K3hIsI0c7KEtBCVqCF+AOPYuNZoLxCQMe2q420ubmG+CP2PR99dJjy RueeRpZVkM/Qr/pyOSnz/GLjUWUX9b7ZKUja27zAkg54EyuW4sE+DUU9993dhVRriN5n B29kjKM6xrrgx1MmbNI3XQopEE0oC0rfa476pjEj7Ile4FXnsBvgYeNJ4ygNBlOom3K4 cy71aPHH+1vHfr4Te+78Zqz3reQlhG7giObXvyK1rsJ6AJzIXYMdONfg0wuiWdjv5JtC +ijA== X-Gm-Message-State: AOJu0Yy2Dmx+NMpX/3sKlLth+xu7przOKxUVp/nbC0w5/O7+OzsoJ5FR 99gTbG49VsY82tRfLtyBFM5Pi7in9QkG3KEbP6/8vp1gAlYATh9GhSPYP92mpryWtR/xYRyxUi1 l X-Google-Smtp-Source: AGHT+IEOC9Mt121LUZMOGbgq/bBML1Pc3j8MLinnpLNjgkjcRolQAPuoJbIEqAzUiz7UiRJq4scneg== X-Received: by 2002:a05:6512:1583:b0:51f:5d0a:d71a with SMTP id 2adb3069b0e04-526bd694ab4mr1047130e87.10.1716375060602; Wed, 22 May 2024 03:51:00 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:00 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:55 +0300 Subject: [PATCH v2 03/14] drm/msm/hdmi: switch to atomic_pre_enable/post_disable Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-3-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=2151; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=osqs9uVQGma2pB7Uqqmi191XkOj9NO2HEt9nbTjIsVU=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4PCjd2hgbwjgDirDxBNAxSDUfP1Beqm985y mK3+UPx39GJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3ODwAKCRCLPIo+Aiko 1WPYB/9GLMl/u2GZ6jjdkuV0W4HL2lvbKpyLAgp7znyuLJlQUAPszh1vOixoX8xNGhFns22vham I4iJi+J8EkXyOxci+LIH4tRVsV/SxwHRSEW/e3Cw2bXrKQmcDYv7fd+0GHrCCLjcpCMyebaojiW zRBJyJl3CHbBr5p9gzsVLMJylnF0DZTA1ug30vaVjh9K08tofK+gyZ4Ispn4JPX3qyHCuXfciM2 bPq0rZyOMrJ8bx5Jt46S0g3gIGzI3yhMeb83rVW7IeutOq0m1XsS63rQmH/ccGOypBcBVfxVRjx JO7Ny9cUSQ2fG1qG4VcrKyPdZonoRdiIM6VG2BeF/b+MX3uD X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A In preparation of reworking the HDMI mode setting, switch pre_enable and post_disable callbacks to their atomic variants. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 15 +++++++++++---- 1 file changed, 11 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 9eb4d06bdc0e..3c6121c57b01 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -120,7 +120,8 @@ static void msm_hdmi_config_avi_infoframe(struct hdmi *hdmi) hdmi_write(hdmi, REG_HDMI_INFOFRAME_CTRL1, val); } -static void msm_hdmi_bridge_pre_enable(struct drm_bridge *bridge) +static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; @@ -146,7 +147,8 @@ static void msm_hdmi_bridge_pre_enable(struct drm_bridge *bridge) msm_hdmi_hdcp_on(hdmi->hdcp_ctrl); } -static void msm_hdmi_bridge_post_disable(struct drm_bridge *bridge) +static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; @@ -292,8 +294,13 @@ static enum drm_mode_status msm_hdmi_bridge_mode_valid(struct drm_bridge *bridge } static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { - .pre_enable = msm_hdmi_bridge_pre_enable, - .post_disable = msm_hdmi_bridge_post_disable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + + .atomic_pre_enable = msm_hdmi_bridge_atomic_pre_enable, + .atomic_post_disable = msm_hdmi_bridge_atomic_post_disable, + .mode_set = msm_hdmi_bridge_mode_set, .mode_valid = msm_hdmi_bridge_mode_valid, .edid_read = msm_hdmi_bridge_edid_read, From patchwork Wed May 22 10:50:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670756 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 F26538249E for ; Wed, 22 May 2024 10:51:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375064; cv=none; b=fBPjz8tPHh9IuUWDnK2MylW4UQ1/0G8Qg291JzmS/CLLJIQ+nx8cedC1pf/VIejY8mSS1dgWj5UEiJ4ECur5q5sjZz5HzF6wOV0M3GxOS+OYlWhvY8FGEWWB4L9MfOLX/uZn4+qMxPyYA64/d1D80w8+OZJ7zdsUNsdxTEyElDY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375064; c=relaxed/simple; bh=v9IgZbEVIzCU//v+7Xjr4VR0vD49EBefgZxRpj3Zixc=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=N0+8B1UYvncplbxBnPFT2abYMWU+wDJJ240HdAIryCv+jb9xDi6YFQxYbhigBbBotzOajqr3r+XqC8NprBx50DbRqx4JWv3tACs7Z7bwr0bTXQ0e3O5K3TAg3CI87c7dDNhGXiJh8+N1Gjh1TiYgB+CyGbO1wbrb6p8yAhO/qlQ= 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=oMUeZCxD; arc=none smtp.client-ip=209.85.167.47 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="oMUeZCxD" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-5238b7d0494so6428332e87.3 for ; Wed, 22 May 2024 03:51:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375061; x=1716979861; 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=/cpewU7AgCBeUcebhA/squE/VnkWqKDOhJWxtD0Wziw=; b=oMUeZCxDlmZY0BipfZBye8cMd7mS1uOpJiXforiOXxfT7WARyXx5lhXfqEeHHmlUzm vZNLRkM70htEyPM9IvXMPITKkFFMs5wcZSbGFOS3bUbaq3B3tadTWrr1zNOZYWk2U8+T J2+pAQp75r807Idmk0Gk0WpTMEfzzXGrlsO9TdHDIoan1tU8BS0J9JaH8yKjbSR6u096 ZKJ/huwiyccSUhQiimk0n/UcSnrpbD7qBUaMCUt6cbkwMU05i6mcVg9doiwLNDhIHPiS b8oCZWEZYWGCW1auJTx6Wat8OElZf9NK/Iuej1m+dxQvepW0EmVHB7ncAjWPc1yc81il HVJA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375061; x=1716979861; 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=/cpewU7AgCBeUcebhA/squE/VnkWqKDOhJWxtD0Wziw=; b=gU8llgxg5bWQFBjb0UVBZsF76et1MDlMc2/hJuHS0EebUJKfF0xvunERMtIGyMg71i w+KTy20KygHDqGVxnNQGUttQwgldbEWgweZ1dOqhQFvRMLggJg+I9f5vSN9BVdOqL/Kk 1CGd1J7DDgcM46nZHszh5oyqv6RNqvbn2ByVo1dVZJQnmRNlHreeE1wUmTVjHDfL0+Bt AN5Bs0AhDdTKqFXGkkuzb/xqHYeBZMRxs2ev1vTh1nfa5aL6nxgto07bwk7HRTJO3Ydb vyhTmQ5q68FNzQjy6fkbsvKC+KovinLx1646i5Uet6BDR5Jd8b/jqqDa3mr083F3t5bd g+9A== X-Gm-Message-State: AOJu0YxZC1Sf8llM658PVGXyE7w4MmQEap+9hGPWvRX1zqHaF/Q5i4Ab 8IYpFI58NGpU+q1oZ6CNnL4A2CETdkLQJRBPM/ZYcFRHcm3ao1+6Q6ZzeHIeMeI= X-Google-Smtp-Source: AGHT+IHA746vcyQKIF6ARQUrKclZUZ17SOeurs4Y7bb5zbXhpahNcHMlhYUZc1enWJkGEceoCKPVVA== X-Received: by 2002:a05:6512:2030:b0:51d:1d42:3eef with SMTP id 2adb3069b0e04-526bf82d08bmr1528410e87.29.1716375061315; Wed, 22 May 2024 03:51:01 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:00 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:56 +0300 Subject: [PATCH v2 04/14] drm/msm/hdmi: set infoframes on all pre_enable calls Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-4-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=1133; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=v9IgZbEVIzCU//v+7Xjr4VR0vD49EBefgZxRpj3Zixc=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4PZtDbcPARHAK4vTPyxmPCjneihSIWI/DGZ yc1CddrMImJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3ODwAKCRCLPIo+Aiko 1QuwB/9C68k51MnziXzY9cD980CHlYfmEBZfzN3HRPuRudP0j0YzyHWgbm6wN+ZIQY4jaqGVNXV 4T6y6ytqk8N1gNtMxki5EfrFIiQDKRYxXyAYrRgiTzzjI0g6vBAThzSgKlJwXnBzu3LZJ0rNPBD gRrFHl1GehF5mJ64QLav5u/c5z7EuAX5ElXSH0DjRsfdnMsGeTyD73KCyNw94bk7XeeGKf6R/bU 6k5iRyb6YQLYbv3Nkgy173dvexu7PNVkL6FDi3yKAUfCG+i9b0RlqKDbYT8r+VfvR3bMX+n5dt5 wCrGSQLNLCj7cHogLW0nFCKGhkFBzo3TPJ2i9qjyMejciR3l X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A In consequent modeset calls, the atomic_pre_enable() will be called several times without calling atomic_post_disable() inbetween. Thus iframes will not be updated for the next mode. Fix this by setting the iframe outside of the !power_on check. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 9 +++++---- 1 file changed, 5 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 3c6121c57b01..fb99328107dd 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -133,10 +133,11 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, msm_hdmi_phy_resource_enable(phy); msm_hdmi_power_on(bridge); hdmi->power_on = true; - if (hdmi->hdmi_mode) { - msm_hdmi_config_avi_infoframe(hdmi); - msm_hdmi_audio_update(hdmi); - } + } + + if (hdmi->hdmi_mode) { + msm_hdmi_config_avi_infoframe(hdmi); + msm_hdmi_audio_update(hdmi); } msm_hdmi_phy_powerup(phy, hdmi->pixclock); From patchwork Wed May 22 10:50:57 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670761 Received: from mail-lf1-f52.google.com (mail-lf1-f52.google.com [209.85.167.52]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CD94A824AD for ; Wed, 22 May 2024 10:51:03 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.52 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375066; cv=none; b=GcMQFIVDqEX9QZpioWb0s7nyPnA1Bkyh+2/jJe2ia/VYQQTjOc92l0xZs2ft8WAIEk0J9Vjzy2NcBTn7xiv0ZGnxOpGsUCWH2AA99GxN7px9tFIbvXwgsArW4KfUS7bFf6r4bA3y1au6qCIyaHfAc8F3cwl3aYHXRTubv9YYmw4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375066; c=relaxed/simple; bh=K1KI+nZVasxZlSMfFS8U9hLPw6QPc6PsVGWsUOlWg9o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=sxSYCktN5K8e4Arr0BZsL+oO0x65hDWnl4PHX48Lr4RTewKwM6Woum2GogY1F3uMgGFMgl3FxL1s8XrBNe3AzF1kP00ZbK+8Wdf1yvOLUxOMtShFk2SO8BXL8BgPCwbNdWapDXZP6IwtSw9kNLiZydh/z/DPlZcU+4S2Q42vYx4= 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=CjupJRt9; arc=none smtp.client-ip=209.85.167.52 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="CjupJRt9" Received: by mail-lf1-f52.google.com with SMTP id 2adb3069b0e04-51fcb7dc722so643788e87.1 for ; Wed, 22 May 2024 03:51:03 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375062; x=1716979862; 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=tsC/gRsvFclAEANavYSBlEUjjyUnanQ9kBr3o4SWpJA=; b=CjupJRt9CqbVSlMtBqOvGzoSBwc3+xhxQgFfLGk26h7IonFMuQ3T5F18qOaj8qAT2D PaTA6ovZA8w3eJMMl8oRdQGBsFzT+C94K7PRw+OEvtzNjt7k0rq5SWejP5Gp3ZLC4+nl Bcymip1C44ZSgr8xzqgHkbM2JGwnu8cvznlQsT5wLDuS5zn5ihHb1ohiPGOwaWFpTi1f crPey6N1rRR9QLoHdWsfUuzef0V35qco9NNhPAs5Y6nStg55XqQxWNi6Bio6nLC70dSQ sSEDvEC47PywWjDVUtCOra4u2QIqQXrpBR4YV/cEYhMIuZ+uqb3Qfgvg57L1PQ5wx7h9 dNHQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375062; x=1716979862; 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=tsC/gRsvFclAEANavYSBlEUjjyUnanQ9kBr3o4SWpJA=; b=lgxdb+Gi8aik0Qu8x/swxOFpHjziHiMjoKotmuD2bMtp+1EoOnCXsxSSITYGEH/MWQ r6Akd/NUVLBRSGUB3X13cV0hfABBzQa1o/kXo6h18RR+QAzd1ZaerGtAh3aISZ5pQylZ TJesmrrIb9YgASdWZlryqv+oObmbFRRu/AMNZsaiukKsiQMHu52NZAzAtyOGjKAsH//0 3YhH/tamSJGw01ufDFodbQMtyr93r5tq+Zy1teVuNTeUd7TMznlpXe8X4hlKzpWLyVpr KASIpI9CZxu8qwF3opWJX+LF3eSAXrj7RdJ6u5eqomWdrscPfCs7fDzamPYjl7rCU2Jq rxkQ== X-Gm-Message-State: AOJu0Ywi+40vrjmCDxLwp2PhlAA3RKG9yq+Whsxo61LnJmORo40Kwokl JhydwK0HUABvxMaCmIM7+bKqlHatGnkgM7d5qBvyFF+v1K88ujJrE0G4t1uywp8= X-Google-Smtp-Source: AGHT+IFKBWmoLwb0ELld20WRYh6MP860S9/NAr7J2q43NCXsCE00e4g0SyRTBt1FvFJipTvpKF/64A== X-Received: by 2002:ac2:46ca:0:b0:51c:590f:4305 with SMTP id 2adb3069b0e04-5269b2e6679mr529373e87.8.1716375062015; Wed, 22 May 2024 03:51:02 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.01 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:01 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:57 +0300 Subject: [PATCH v2 05/14] drm/msm/hdmi: drop clock frequency assignment Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-5-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=2294; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=K1KI+nZVasxZlSMfFS8U9hLPw6QPc6PsVGWsUOlWg9o=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4PVwLPggWZS7nDhhkL19OkYk1UVB6HyzzLX mh6kxylRy2JATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3ODwAKCRCLPIo+Aiko 1T3zB/9Tc0eNy+q8LiRXQPBs5tBj5FD0fCU6cAnP2CgFPzBGWPNFSlTgvY0wUYAIhkX8udzpSbe mhSARwL1p/kUkAYWEVinpmOOjzyfowqVQqiXtzGJgeCpzcLxg9YgdAefRuO5X4FMjOQIydeexxK 4rFnK1ZBFuYeflTip1RBDLYsJfVb+Mt1XfJbbu7SRpyLkI8jEcESSPvtimktULPTKI2EYn3yrFE 2u3lrsW6FWkc2GGo3v+uhClA+Q9YScQllpF2B+Z5ASitZziAnHHhXXXGZEN49f/AwmKHdT31gRc qJdqXDzQTGkSf7y4B0qFRGA5bslOc2ncIzYVceNhmOuRAAG7 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index 681265e29aa0..c14e009f38b1 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -236,12 +236,10 @@ static const struct hdmi_platform_config hdmi_tx_8960_config = { static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"}; static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; -static unsigned long hpd_clk_freq_8x74[] = {0, 19200000, 0, 0}; static const struct hdmi_platform_config hdmi_tx_8974_config = { HDMI_CFG(pwr_reg, 8x74), HDMI_CFG(hpd_clk, 8x74), - .hpd_freq = hpd_clk_freq_8x74, }; /* diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index abdbe4779cf9..c0d60ed23b75 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -96,7 +96,6 @@ struct hdmi_platform_config { /* clks that need to be on for hpd: */ const char **hpd_clk_names; - const long unsigned *hpd_freq; int hpd_clk_cnt; }; 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 enable) if (enable) { for (i = 0; i < config->hpd_clk_cnt; i++) { - if (config->hpd_freq && config->hpd_freq[i]) { - ret = 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 = clk_prepare_enable(hdmi->hpd_clks[i]); if (ret) { DRM_DEV_ERROR(dev, From patchwork Wed May 22 10:50:58 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670760 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 8925482869 for ; Wed, 22 May 2024 10:51:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375066; cv=none; b=Rtroy89vdRwMlnCV5dnIDE/RoerHJDymLscvrB24wLZ+kke3WvZ93ATypXdUQkeMzPjMht7g4VlPE0/3FkbDw49MeDF4P2hXDvBV4jpAdYw9qk3Yhgp3GfHEE7vClZ7I0ljHiaj+4zxYy0Si9JkyhP9Lr3a6IKJSqICXeTvMWt4= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375066; c=relaxed/simple; bh=qWoWxaBIT57QfQL/H3b3qamuy/KWc1sBIdaw/+EtJuE=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=JILUY62YXrXWlxpNYWaD3hOl2tQWx3Togo7R3U40MtZWyE7J7/hF4Y9+MqnwAq9ULKyYkX5StmyXRNLIuaHAwOM637ngRqF+BXo5UPtvhCVVyk1ZW47iZsl3P2sT6p471YQnbV1/JcaJg/dhrO3B8YyLL7UOm8gwAdsdlwXkgEo= 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=Xf0382W7; arc=none smtp.client-ip=209.85.167.53 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="Xf0382W7" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-5238b5c080cso7888137e87.1 for ; Wed, 22 May 2024 03:51:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375063; x=1716979863; 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=Thx5VEVIdtS5W6YUF2PWAi/DMOAy+79Zm1AEBWpV7cY=; b=Xf0382W7oHg4HtgzOES28PyexMoQR9x8xQEUhn+BVHJQDskGPdKCqsfD1G+ynr/zwK u0So3Y8o5qLR/t95IBbgmPjCLMEcJp6qS58r0LlyPLZ6wA3cQWQMNiwwQuPXM37uZMFY 6x74oAsh+Vq8d8LoKeHn5aRRGHcaTCKYsggORLlIgI8toBrZSUeM3zCaJ3k3uLoH+9tl YB7djfDmk6yAvzHdgYyId/9mwKdv7IK7Me6++Z95CvjgW3b57U9kUmQNyEZWXOhnjMkP QKWMw67DZenb6gjVgvwxHi5XK6U/t8I5OfMVS1VtgE2v0/PfpMOqjYxqWrJvccUUrwcx sxqw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375063; x=1716979863; 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=Thx5VEVIdtS5W6YUF2PWAi/DMOAy+79Zm1AEBWpV7cY=; b=kOnLjp1vhqNtAekUzKJXA0NZHBUuH5H1+gC0qAZst01klJguOY6Tx0Pt60AJ7Yz/qx BukirRLYH1lqzjXj2sprw3/ydnCnpa0mmBTfFpP1LwIu+Y2fyoM6lEMXFIbQf+9Od4pv RZIYAdcmG9VcodFYZaxF9X/9EkkGncixmRC1IBJ7yAvMqKBJvHkePVg3n90gwm+M1JPu ONk2Wv4/1ar2juMPycJ489+H17sORDmDQca3r4mLdwvgb7Om8K+g3LsCyqqXM3hXGyiN hFSpFtDLNiaMTWUAZtugZBrLgM9X10oPhNh+kFdQGidcQWyjxO41koR2PDYfvE/+AkiV q8Ng== X-Gm-Message-State: AOJu0YzAFmCEvumb/bdc5Pg7JXJFiNlxS5Gb0iZjfQZR+0+lKMOjk0t7 JzalYnVG7R2YhcWHb7n2uwHcBfQ17BM+QNe/3Mo3NMsZVPM3AzaFLLEwUY9EDp0= X-Google-Smtp-Source: AGHT+IFN/5I+WfK1fn5/Y5SqzUG4dzDQSqWg9365wTwasAYWN8c53SqYLJBZM4tHc7Y7GU7QdS8teQ== X-Received: by 2002:a05:6512:3607:b0:523:48f2:e3fd with SMTP id 2adb3069b0e04-526bdc53aa0mr840925e87.16.1716375062796; Wed, 22 May 2024 03:51:02 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:02 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:58 +0300 Subject: [PATCH v2 06/14] drm/msm/hdmi: switch to clk_bulk API Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-6-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=4258; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=qWoWxaBIT57QfQL/H3b3qamuy/KWc1sBIdaw/+EtJuE=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4QhcbTNU1xZ4zo5pb7Is97xUeXSclmnMHPO dnPqXumZJeJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEAAKCRCLPIo+Aiko 1QLEB/4gFS6pepNvbhCKqUq2k20uwDwdS+34Dhukn30EerccF8nXVS1JtS5x0be0enjckgxW4H5 gZi+UPdUoUsRQlDev5eALmLY3uubG6EJoWGHbV6MwyiLk3YuFSrbi0bmJe8EID0OkJ2qRKqDNAH ASO2yJquay9eV8KQPaqYUESX66/2JVxFShOuBjNWPmUgyE4ve8eUkYGLY1/CybiIly4pP71Z7JZ 3PC92joqtA8NlIZucUqNWgdn1jUSGvRaUWkQ9mwVE657TFH2i9cMJ5P1rTWJMcYK9pIyIyYUAio c2aB8t9VYo/RHkhfXOpAZGS286LncX3QMmj+KpV1K2gtELpH 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index c14e009f38b1..7ec4ca3b7597 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -469,17 +469,12 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) if (!hdmi->hpd_clks) return -ENOMEM; - for (i = 0; i < config->hpd_clk_cnt; i++) { - struct clk *clk; + for (i = 0; i < config->hpd_clk_cnt; i++) + hdmi->hpd_clks[i].id = config->hpd_clk_names[i]; - clk = 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] = clk; - } + ret = devm_clk_bulk_get(&pdev->dev, config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + return ret; hdmi->extp_clk = 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/hdmi.h index c0d60ed23b75..eeba85ffef09 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -50,7 +50,7 @@ struct hdmi { 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; 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) } } -static void enable_hpd_clocks(struct hdmi *hdmi, bool enable) -{ - const struct hdmi_platform_config *config = hdmi->config; - struct device *dev = &hdmi->pdev->dev; - int i, ret; - - if (enable) { - for (i = 0; i < config->hpd_clk_cnt; i++) { - ret = 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 = config->hpd_clk_cnt - 1; i >= 0; i--) - clk_disable_unprepare(hdmi->hpd_clks[i]); - } -} - int msm_hdmi_hpd_enable(struct drm_bridge *bridge) { struct hdmi_bridge *hdmi_bridge = 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); pm_runtime_get_sync(dev); - enable_hpd_clocks(hdmi, true); + ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + goto fail; msm_hdmi_set_mode(hdmi, false); msm_hdmi_phy_reset(hdmi); @@ -149,7 +130,7 @@ void msm_hdmi_hpd_disable(struct hdmi *hdmi) msm_hdmi_set_mode(hdmi, false); - enable_hpd_clocks(hdmi, false); + clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); pm_runtime_put(dev); ret = pinctrl_pm_select_sleep_state(dev); @@ -193,14 +174,20 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) static enum drm_connector_status detect_reg(struct hdmi *hdmi) { - uint32_t hpd_int_status; + const struct hdmi_platform_config *config = hdmi->config; + uint32_t hpd_int_status = 0; + int ret; pm_runtime_get_sync(&hdmi->pdev->dev); - enable_hpd_clocks(hdmi, true); + ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + if (ret) + goto out; hpd_int_status = hdmi_read(hdmi, REG_HDMI_HPD_INT_STATUS); - enable_hpd_clocks(hdmi, false); + clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); + +out: pm_runtime_put(&hdmi->pdev->dev); return (hpd_int_status & HDMI_HPD_INT_STATUS_CABLE_DETECTED) ? From patchwork Wed May 22 10:50:59 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670762 Received: from mail-lf1-f47.google.com (mail-lf1-f47.google.com [209.85.167.47]) (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 66FF2823AF for ; Wed, 22 May 2024 10:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.47 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375067; cv=none; b=Hc8Ikg2FrwE6CXi4DoAK7VCU4bILzJxXQgd5a7CrkcmvdPvGrAiWCX+1JkLcqyoSIvyx3c/XIxi5AIgegOohEXSGBk05D73RkLCzUbNO8uE9QGyAi2JudmCJsjeml0NXNEw6zP07BxpU1euSJqFbKGW7f608s2TUKGLS8v4AgOg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375067; c=relaxed/simple; bh=rVRKl0jVYPeqcqz91TQ881Equ4F+ZgpwdiZXFz89P0g=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=F35pyq1v2jY2MV64LGKsL5RemafPSRB0dovLx4k29J/uQiGlfplomA13CkTJ9dpGbH3PQ9StMVL5ZVDJ/L5agl2r5Wxq5RUS5xIs5xgtDHJ/NwIYMFjXEowVUibnPB7Wcshc1+kEuCcFBMe/cNTIm+oAWM8gMdzUNKv4S1T6cug= 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=Jt0d8YIR; arc=none smtp.client-ip=209.85.167.47 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="Jt0d8YIR" Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-52327368e59so7149779e87.1 for ; Wed, 22 May 2024 03:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375063; x=1716979863; 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=IAmphMNQpXqW8eT1O41Bu5TdohycNUyawz5wYr1vHd8=; b=Jt0d8YIRnom2NpB7q0YHMMJKbXklgQdCgbEqOsOoSTwR2YxgkYDr0KJHiOPlUkM2h5 WvZDh0/QgolGHG96cncqfJwnAWykHmNjsaw4ceL8JPT9Ust/70HbvKMHH8j4Rbx7th7d z4Ddgq29+tGTC+JEbo8GXD2+/k8OGLjvmpagHjZtyi9sHN97hXjoMLHdxGoV/WGa0Ohl gEwSluI+QK2ZtL9JNMPqk4vEld2BWgciB52ZeNie0BtKFz/W3AvQSyGaLuR88G14EYD+ x1gDO9KG9e+ifDcaSrhG8Xb967GfsPWu0ADduCI3CCEImBDUq9bnpubWPzwO3AzYFM8a bRLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375063; x=1716979863; 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=IAmphMNQpXqW8eT1O41Bu5TdohycNUyawz5wYr1vHd8=; b=lC1A4cVjGQjZ4ObwViBf9DfH8EB6SpWvEfjFYd9ympR0CeOW3TN0cYgnrUNo6a+IHd 1TBP/LSOv/ng48UyOUbMIrgv6qMXSnh9zzZg+fmTphAS0AqoQjIiujWUFnV8UYsMPjdC iiZQ8qAgroViKbgqj+H5HKihVipwrGOVA3p98ZyjSyOQ0wyL9tthbVCuGlvpCcp3SVDA loHBqUTZgKxPFj2zM6gkPWAuKPcKoEBpDlvZyFoS045ywUikkO7p6QrBkn6khLCXK+K5 NRkp1/F/68+U0439Sm68QEZt85V1vplg2z00xuEd0QLvrsumZydc+XKZ3h9AY8OC3nGM gzyQ== X-Gm-Message-State: AOJu0YwVTnZgDAagj+O7cyEvI7uDZFvSGIKxB60aPM4aRkppk9ml2Lm9 Q4/06EDgKjtw6JIHXInYAizQX6fwkuFrY9Pzw1J/hB+0j3SVKWke06HsNofbZvQ= X-Google-Smtp-Source: AGHT+IFvKJh7JOYXQJKM2qi5VIh0iYd/BGRN6yDP29LSOK7OX2zXaEKTsibdu8B9a2dC6ZHLhKrCjQ== X-Received: by 2002:a19:6a09:0:b0:51d:5f0b:816f with SMTP id 2adb3069b0e04-526bf35c690mr832319e87.15.1716375063679; Wed, 22 May 2024 03:51:03 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:03 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:50:59 +0300 Subject: [PATCH v2 07/14] drm/msm/hdmi: switch to pm_runtime_resume_and_get() Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-7-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=2613; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=rVRKl0jVYPeqcqz91TQ881Equ4F+ZgpwdiZXFz89P0g=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4QmHQVBTWzpD8Jbi0KRzPokGAEgSr3P4vPX 6mb04s1+KiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEAAKCRCLPIo+Aiko 1fSQCACsc4K3scUWB77PU9aHBfrcHuUnWfl6JI/ujLNtLgxLO3Gc1GO2QfCPmY0NwhqA29kIB18 vJ21o26KCmZINsMjIV/y7yFwUEX+oa4+2d39ZLu/s1YkR1wasrTckdY0sPYebJxxkNc9JAjaO0p ofgIEbCuajfb1AJFLf+ygf9ALiPRqLlVVM3rWvN/sxeHKiahb+TE4NbHaUzdTCas5RCFj5rDVQj QQz2mdlVfmrp82eJwicfGToeL6X2DSvkTQ1UtsBCEt/a0Bo5uUd42ND5xfcWVrxZSEwox3LzVDh W9TTH9jpEtbTPnHu8fjEp4MQknreKmXwj8w06V01FkXAesNB 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi/hdmi_bridge.c index fb99328107dd..d1b35328b6e8 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) const struct hdmi_platform_config *config = hdmi->config; int ret; - pm_runtime_get_sync(&hdmi->pdev->dev); + pm_runtime_resume_and_get(&hdmi->pdev->dev); ret = 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); - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret) { + DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); + goto fail; + } + ret = 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 hdmi *hdmi) uint32_t hpd_int_status = 0; int ret; - pm_runtime_get_sync(&hdmi->pdev->dev); + ret = pm_runtime_resume_and_get(&hdmi->pdev->dev); + if (ret) + goto out; + ret = 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 = &phy->pdev->dev; int i, ret = 0; - pm_runtime_get_sync(dev); + ret = pm_runtime_resume_and_get(dev); + if (ret) { + DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); + return ret; + } ret = regulator_bulk_enable(cfg->num_regs, phy->regs); if (ret) { From patchwork Wed May 22 10:51:00 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670763 Received: from mail-lf1-f53.google.com (mail-lf1-f53.google.com [209.85.167.53]) (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 1DBCB82D66 for ; Wed, 22 May 2024 10:51:05 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.53 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375067; cv=none; b=G5T6Ey/6sayx8B4VSZ0uRMAtDME7rX7WcAT9Eb0So1Bnc5S59uWQocM4pjQ/62T2ZvNYnxLVuqQElgk3kP2TCyhZh90d3uwHt+8jYA7eRj7kvF5bazl4N3Bp91q6pItqcAXwC4ZD39AtjkM7SSBNgJfYvQhUKnQ0A1poaZA9SCI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375067; c=relaxed/simple; bh=Jgttl5H44Vld14qWMns1jroXWg5YOpL1Dc2oQSS9ypw=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=VReAJ408O/lc2xzmIgp7X6EtH5+3fhlqhA7vxyB0rWnxREIYmdh+kw67PSGIjyBQJKS+Q2RtuOn0zjEw0C4xxbrvKUdO4Yr3znEC6X/BFY+6zEm3ZUu0AP0ctOVj2Nj6c8WDjhULEgnjpgN1ziY3ERBDBwO9ROeSF1MgN/tJnt4= 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=J+DkYB/g; arc=none smtp.client-ip=209.85.167.53 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="J+DkYB/g" Received: by mail-lf1-f53.google.com with SMTP id 2adb3069b0e04-52192578b95so7497944e87.2 for ; Wed, 22 May 2024 03:51:05 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375064; x=1716979864; 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=r6GgwKTdsZwJRv3Ukk7SFtFzEc2aaRxTR76EeCWgZKA=; b=J+DkYB/gslx7TMhjgQCCJh3/Ltmu/25tbMFf0DXtl2i7IoamLjjtvvu55HmdxBexTN O0OYeyscnvgIDLaGNgm0+f7X/zcSGHsDBR3I4GQWjkFPa1LLwO7jk+NdocoyRAxfYWhU KxTpQBTmfX450e1dKTrTRjrqVJEKuOOr8lMyCVFrF73z1XNiHY1StAu4mG2jdfhIr24I 0iojeGJS1ZUAzgGwzvSWiwL9zmzvq+F6af/TAgifgsxBpcQGbYQJQNiH3S3IzrFTNXrT oNQ8WtnlCyhrBcY9sFDCQdeHT3kMuhQaiflX1S/FrVNdQmlG9UT5Wn/Nb3FdDqBhhRWn q2xQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375064; x=1716979864; 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=r6GgwKTdsZwJRv3Ukk7SFtFzEc2aaRxTR76EeCWgZKA=; b=t+DLxYjHNp/DS0vfAyAfEyio3c1+W/WJwl+2w8VnFOA2GAlM3BHief3W76LjqaNf49 HhnjJyFw8KUvcCLMCONUu7uzK1Ut7IC85NevvCBmT3kff8DWgT14pwHQzO10q1tLj4XV dHSiRYtTG5deW89nct3gd+rN3PHq3lXM3I3RJJBNKkMtPeGftPB91aZU047JV3BX7NMy 1Ai8Fr533sfHGXtJgaYVDUh4OfrJaXXijqbMLpovbkfpiqy/+2m7YcOtRL5F/S13v/jz rQdI/xlgOCgkVrnNNFYKnIpyPh5ixTGE2UwMXo1/TC3Cmw1AGlowGK6HiqLqHgcuzZRv UdsQ== X-Gm-Message-State: AOJu0Yz7zVDzkhFW8ogOA3jzljjF82g+SbKvho8NfL09CSWnuEfegbxI L2XtbnCA0J0blxqKJi2sH1ltGJ+GKCe8Go8LLprtfJ+EBbUuepzZJlYh2El6Jfg= X-Google-Smtp-Source: AGHT+IGZEv+CIDPXP0TJ1i+AotzbFz5H7fqitUI/2i1sh33JfiQ5E7D0YHElItOMq6UM8jVLtSM+jA== X-Received: by 2002:ac2:47e8:0:b0:521:7846:69d1 with SMTP id 2adb3069b0e04-526be6ea784mr995436e87.6.1716375064461; Wed, 22 May 2024 03:51:04 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:04 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:00 +0300 Subject: [PATCH v2 08/14] drm/msm/hdmi: add runtime PM calls to DDC transfer function Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-8-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=1518; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Jgttl5H44Vld14qWMns1jroXWg5YOpL1Dc2oQSS9ypw=; b=owGbwMvMwMXYbdNlx6SpcZXxtFoSQ5rvOYH/AvxRXG5PuivCtgZbTDkzq5nVPWvqSuvbF7bJ9 rk0FuZ2MhqzMDByMciKKbL4FLRMjdmUHPZhx9R6mEGsTCBTGLg4BWAik8U4GBpOrL91US2S2SFV 9ZCs0o4mLsaQ+M5Xpdm66VVdr8SybSZkrV92JVMh3kPGLmgR67tHLIlF57/r1jWJRc/4UDnxY+m eeTJx0/alXEoTqJaWKljNnD9vmuILxjDFKMP8sMMFJ0svhu7uyJeqCn45Q3lKZMEFZq9JrYpvfy y7FHL66gttO929211S1l5RmLlJsmeSBLf7boZrZzszPBmMFyzbI5fVJGMSfdl5+4nyf9t1vyXP/ PukZV1B4yyra3/OSLzOcK6Z+CnSfLVGYfnVbwyO/6VbMg801y/ROpJzgLss7q1uTcbtjao+B2Tf 7zvHoJK1ZYrOpKDmdXeWHam/tVr6j4H+YcHFqf7lBVKnAQ== 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(). Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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 == 0) return num; + ret = pm_runtime_resume_and_get(&hdmi->pdev->dev); + if (ret) + return ret; + init_ddc(hdmi_i2c); ret = ddc_clear_irq(hdmi_i2c); if (ret) - return ret; + goto fail; for (i = 0; i < num; i++) { struct i2c_msg *p = &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; } ddc_status = hdmi_read(hdmi, REG_HDMI_DDC_SW_STATUS); @@ -202,7 +206,13 @@ static int msm_hdmi_i2c_xfer(struct i2c_adapter *i2c, } } + pm_runtime_put(&hdmi->pdev->dev); + return i; + +fail: + pm_runtime_put(&hdmi->pdev->dev); + return ret; } static u32 msm_hdmi_i2c_func(struct i2c_adapter *adapter) From patchwork Wed May 22 10:51:01 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670764 Received: from mail-lf1-f54.google.com (mail-lf1-f54.google.com [209.85.167.54]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 133DA83A09 for ; Wed, 22 May 2024 10:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.54 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375069; cv=none; b=LXo3TTADP5UC+qan0V+G/1WhYMI+9jFj1SHt77uGa3f0M+jgWurj4veaFO6zN48LEk9o0Szpm6r45kGT8LMAt04BxEKKVd229iwtrlurJPKULbmkBbbA1iOcZlL9UaUqqMOesIR1GNCvujWhqDUR1wg1O9R8vP4sKMVEtrbr7tY= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375069; c=relaxed/simple; bh=Lc0bVtuFpNb+Ymx6Sipm+Khv6fPSaylIkez8yRj45ho=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=LSfMjF6ZIf9iyStnAOxxwbm9pv/z2As/kO64XvBtQk4NgfnEtuGM4gPU5p4CwUp44GsfDysDywqh2wLHMxl63itrtLVRY5vrj0KeHt+8qR59b1MC7p08BVwQsprZahGrmBmTuHoAxrXMN0z84EMSjdjA3AtjNBFsaXGgwMyymxo= 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=oLyr7YIZ; arc=none smtp.client-ip=209.85.167.54 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="oLyr7YIZ" Received: by mail-lf1-f54.google.com with SMTP id 2adb3069b0e04-52232d0e5ceso6479881e87.0 for ; Wed, 22 May 2024 03:51:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375065; x=1716979865; 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=8/jygvMJ3/GBJyU+8CJDKmRqXu0M260iVTpHcmYrXMY=; b=oLyr7YIZXRu922irTilxGVBnzwYYrNuPmFSPIxcWcmCMg8BI20OoaxfnlvrUbKNMdv fpqemqhpKIPLWm8Te5bE2OSHlL4imUAXv0QcrDj+Bc6N4YxtAMOIa+2oxxMm2NUi3XU+ v5OyB1n375GCHMTfXM7IcC6vdwuUcgTq6AMggK0quNZl6ttaiatx/bviQLUzUcfDVolm BVipIiMVV2WI2W16QZZ69XJhWVWt8QCswG3JAmaNVLAlbvxp4yQRNmLFOc6TnMsljCtI 8vy0OJCP6tewO8Mm4h3KvHT+l626v80DB69u2l4ScMz7b5ndS1fEqrcJle6K4Jl3C3m4 UmaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375065; x=1716979865; 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=8/jygvMJ3/GBJyU+8CJDKmRqXu0M260iVTpHcmYrXMY=; b=XEcaOKlBEgL/EAUWPjgyCZB/OMwM3JDrkoAXirYavQ2tdZiknZDA4CkFxe6Hk64bdw IH0R/IpAsuNjkmjRL6/p6MpGVh6tmU1DCn6hw4zH1tOYYE5mMXIk1MAuXW3boraL2mD+ pi6K7BGu4gPxDBlP0pj/Bq+SFFYDqHolYo3kMKtJLjvIDIsnE4VMW9yt0PSc1nJtDwrl Fu+618aLQadaZgx5oquJ+PWegVAKFNXo9D66uUC8Rt2SAp76XM8rg+zqlDxvGL8YDpN/ eqJzM2B1TEFH+Yh71SAgmy/jxs9nt9yBP4xF3vRAmMXnln+vo1XUQtC6KruTXJdsvhAq MznA== X-Gm-Message-State: AOJu0YyhzcD4+6IDj+JOYiuBQi2P/8y4Evqu4DKjTu7q8bc3BBwbDaSY DdNeoJSkd8U2DC49wpEWm8zlRD47CzngNdXHhD/me5a66vnaZqEtWk9Hf7tm8Fw= X-Google-Smtp-Source: AGHT+IGsNvBZcZ4dXFq9HOlPo4tVb7EFJXwQB2v1yDLA+jyRQutXC4QDxtLa58RNAaDnq0EUyYV7Pw== X-Received: by 2002:a05:6512:4807:b0:522:32c0:bb6e with SMTP id 2adb3069b0e04-526bf35cc19mr1035373e87.23.1716375065311; Wed, 22 May 2024 03:51:05 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:04 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:01 +0300 Subject: [PATCH v2 09/14] drm/msm/hdmi: implement proper runtime PM handling Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-9-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=9116; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Lc0bVtuFpNb+Ymx6Sipm+Khv6fPSaylIkez8yRj45ho=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4QKxKBlGU1QsX0EOt7g17wHUC+2BuBaO2l/ q1cfh/zHDuJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEAAKCRCLPIo+Aiko 1R5eCACcwoewyJW/4BM0UAihtifd0M92cx2YkA518iAz4JeePuwZ2oJ09StiGt/19poHbIo1HAQ /xvYd0qPj86UFc9rGU4NZCaTRqsSIEHAfMwyWFDBjONVCfaLwvnz6roXVLCZ7HTPYLOJ+LWVxZC cw1Nx29Xj3HevnIr9Zc0zRgqy2ZPOeZQblHYVMBC0N4IxY/Q+nM/CFQpk6IhmPxqmJj8LTwUKs+ 9bnicc+TQUADmtEtXddI1rVs3DOkgCU/gJvFacT5xSRmmI1aBtePkqEmMoC4+pNlLi1PfSD49VA j5wvhuH3FAA3reta9z2GPsOAw+hXz7q7bQC5sNmyy9FrHhid 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index 7ec4ca3b7597..cc671baad87b 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 #include @@ -226,11 +227,11 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, .item ## _names = item ##_names_ ## entry, \ .item ## _cnt = ARRAY_SIZE(item ## _names_ ## entry) -static const char *hpd_reg_names_8960[] = {"core-vdda"}; +static const char *pwr_reg_names_8960[] = {"core-vdda"}; static const char *hpd_clk_names_8960[] = {"core", "master_iface", "slave_iface"}; static const struct hdmi_platform_config hdmi_tx_8960_config = { - HDMI_CFG(hpd_reg, 8960), + HDMI_CFG(pwr_reg, 8960), HDMI_CFG(hpd_clk, 8960), }; @@ -434,20 +435,6 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) if (hdmi->irq < 0) return hdmi->irq; - hdmi->hpd_regs = devm_kcalloc(&pdev->dev, - config->hpd_reg_cnt, - sizeof(hdmi->hpd_regs[0]), - GFP_KERNEL); - if (!hdmi->hpd_regs) - return -ENOMEM; - - for (i = 0; i < config->hpd_reg_cnt; i++) - hdmi->hpd_regs[i].supply = config->hpd_reg_names[i]; - - ret = devm_regulator_bulk_get(&pdev->dev, config->hpd_reg_cnt, hdmi->hpd_regs); - if (ret) - return dev_err_probe(dev, ret, "failed to get hpd regulators\n"); - hdmi->pwr_regs = devm_kcalloc(&pdev->dev, config->pwr_reg_cnt, sizeof(hdmi->pwr_regs[0]), @@ -525,6 +512,48 @@ static void msm_hdmi_dev_remove(struct platform_device *pdev) msm_hdmi_put_phy(hdmi); } +static int msm_hdmi_runtime_suspend(struct device *dev) +{ + struct hdmi *hdmi = dev_get_drvdata(dev); + const struct hdmi_platform_config *config = 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 = dev_get_drvdata(dev); + const struct hdmi_platform_config *config = hdmi->config; + int ret; + + ret = regulator_bulk_enable(config->pwr_reg_cnt, hdmi->pwr_regs); + if (ret) + return ret; + + ret = pinctrl_pm_select_default_state(dev); + if (ret) + goto fail; + + ret = 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_hdmi_runtime_resume, NULL); + static const struct of_device_id msm_hdmi_dt_match[] = { { .compatible = "qcom,hdmi-tx-8996", .data = &hdmi_tx_8974_config }, { .compatible = "qcom,hdmi-tx-8994", .data = &hdmi_tx_8974_config }, @@ -541,6 +570,7 @@ static struct platform_driver msm_hdmi_driver = { .driver = { .name = "hdmi_msm", .of_match_table = msm_hdmi_dt_match, + .pm = &msm_hdmi_pm_ops, }, }; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index eeba85ffef09..ee5463eb41b6 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; - struct regulator_bulk_data *hpd_regs; struct regulator_bulk_data *pwr_regs; struct clk_bulk_data *hpd_clks; struct clk *extp_clk; @@ -86,11 +85,7 @@ struct hdmi { /* 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; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index d1b35328b6e8..cddba640d292 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -16,15 +16,10 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) struct drm_device *dev = bridge->dev; struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; - const struct hdmi_platform_config *config = hdmi->config; int ret; pm_runtime_resume_and_get(&hdmi->pdev->dev); - ret = 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 = clk_set_rate(hdmi->extp_clk, hdmi->pixclock); @@ -39,11 +34,8 @@ static void msm_hdmi_power_on(struct drm_bridge *bridge) static void power_off(struct drm_bridge *bridge) { - struct drm_device *dev = bridge->dev; struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; - const struct hdmi_platform_config *config = hdmi->config; - int ret; /* TODO do we need to wait for final vblank somewhere before * cutting the clocks? @@ -53,10 +45,6 @@ static void power_off(struct drm_bridge *bridge) if (hdmi->extp_clk) clk_disable_unprepare(hdmi->extp_clk); - ret = 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); } 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 = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; - const struct hdmi_platform_config *config = hdmi->config; struct device *dev = &hdmi->pdev->dev; uint32_t hpd_ctrl; int ret; unsigned long flags; - ret = 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 = 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); ret = pm_runtime_resume_and_get(dev); - if (ret) { - DRM_DEV_ERROR(dev, "runtime resume failed: %d\n", ret); - goto fail; - } - - ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); if (ret) - goto fail; + return ret; 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); return 0; - -fail: - return ret; } void msm_hdmi_hpd_disable(struct hdmi *hdmi) { - const struct hdmi_platform_config *config = hdmi->config; struct device *dev = &hdmi->pdev->dev; - int ret; /* Disable HPD interrupt */ hdmi_write(hdmi, REG_HDMI_HPD_INT_CTRL, 0); msm_hdmi_set_mode(hdmi, false); - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); pm_runtime_put(dev); - - ret = pinctrl_pm_select_sleep_state(dev); - if (ret) - dev_warn(dev, "pinctrl state chg failed: %d\n", ret); - - ret = regulator_bulk_disable(config->hpd_reg_cnt, hdmi->hpd_regs); - if (ret) - dev_warn(dev, "failed to disable hpd regulator: %d\n", ret); } void msm_hdmi_hpd_irq(struct drm_bridge *bridge) @@ -179,7 +146,6 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) static enum drm_connector_status detect_reg(struct hdmi *hdmi) { - const struct hdmi_platform_config *config = hdmi->config; uint32_t hpd_int_status = 0; int ret; @@ -187,14 +153,8 @@ static enum drm_connector_status detect_reg(struct hdmi *hdmi) if (ret) goto out; - ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); - if (ret) - goto out; - hpd_int_status = hdmi_read(hdmi, REG_HDMI_HPD_INT_STATUS); - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); - out: pm_runtime_put(&hdmi->pdev->dev); From patchwork Wed May 22 10:51:02 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670765 Received: from mail-lf1-f41.google.com (mail-lf1-f41.google.com [209.85.167.41]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A2EC483CCF for ; Wed, 22 May 2024 10:51:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.41 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375069; cv=none; b=ofBInH3D2Hx9syJSRlWjyP95A16+K8mmwn0fKNhbOiBDsBG4Hv5qC9fx4T3VBgIUnT0aJjZbfN3YEDDwG/v64AiQv8y9NsqNknq9u8qssbaLi7BuyJZy0ULf+CgqzwrQ6M3MFSYWyGfDRViXradTksqjNGrNyFpOOKXJSfTNGRw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375069; c=relaxed/simple; bh=u0XwnOVdGXgfRiv18KJvoggCPFhhyJzYE8jnecSwHG0=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=CFMCBax2M+CZ/uaKdJR2pbwf3IMdiND3fNz2JYKADPCyvWqLizMLM7sim7dZEP4dd7cnBD84cQ9ta4uO2KcOifrQka9QWFoI0E/QGyYkRPIetwSmL2HZNkawoDpqjgGuqd+v6m95SwXDqmWHa1ftGlVxh+WT1ALm11ZqaeBgNZs= 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=dWIKMkfa; arc=none smtp.client-ip=209.85.167.41 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="dWIKMkfa" Received: by mail-lf1-f41.google.com with SMTP id 2adb3069b0e04-5210684cee6so6655880e87.0 for ; Wed, 22 May 2024 03:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375066; x=1716979866; 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=cKuE+Md2+CJZ4ooxLw6IM33pLF9pqRQyKVYsC0dlBR4=; b=dWIKMkfaUiEnGyu9KdA4yFKn5VvhwX/0Kw9lZEsTc5P1fBZ5ktVWL2yafpvHWejDJW CkrhMyW/3Q0MTGBjYEJCPgsKaa/IeSIW1y2YHy6FI0f7/JGj/5nytvR5DEu6da6am5g2 ALIL17DKbzIXOhULR7FrkUgHS8Dpdc9f5jnsoJ6Wm/5uU8nkUkWsd4JkZcmJ9Idikfr3 5ZOg8VcyZtwmcdejH84V0eqOveF6IjNE6J6t+vy8qV0dDRpi+PZCnrA5hpzMJEME0SAc kJA6v/lDl9UWVZgYykpBS7HeBmkZeYJD0tViU++VsjeGxFP6rio1T5kEw+0cOEj8nRlK cSdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375066; x=1716979866; 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=cKuE+Md2+CJZ4ooxLw6IM33pLF9pqRQyKVYsC0dlBR4=; b=SkPjVr/QO+kcLzFBKODAF44qciIeGxK4GSEZXMU1NYReFpj2pGa3AHaNQrC6U0d3Ky enMnOLLYjXz3bfHYlvGIMfNWMZG0DXp6SFhfJD5S6Qlyr/Z8axkiGgMr7mPplSRbFI6J 4neIU/Q8oTAKodCqopjbdKCtvon6o24LWTuZPB2geCjGWQn7rh2H2ChmKeTH7jbisXcy Eo8n3KtHBWrm4CKTp2wQ5B/cZ+r77g+7LJS4asroiAzSd+Q8IKW5qa/qH2hywgRQmV47 v67zCZf1EUpep1zG8k9fOq4sXQT7rdUQMOmMmfr2ORgFI7fnEFn0TcNSpsO+k045jQOG 6vuA== X-Gm-Message-State: AOJu0YyxvUO1Uqx1m6swkF/VN8hoMI2lAmR+oGHlQViaroE00UmLBj8/ 2XUTyNviOAq5iwX42PlIvC6sisMqinhu5OEQ6PgmJ3vUyFgiBlYHECINozavWOw= X-Google-Smtp-Source: AGHT+IHJeHTfHyWHVmMD+/FJkx5/LYCOdgdKbvGKBtmAdB4VaETozRkOXBbdUDLL9rrVCMVWowSddA== X-Received: by 2002:ac2:58cc:0:b0:51e:150e:2c45 with SMTP id 2adb3069b0e04-526c0d496c5mr830356e87.63.1716375066002; Wed, 22 May 2024 03:51:06 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:05 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:02 +0300 Subject: [PATCH v2 10/14] drm/msm/hdmi: rename hpd_clks to pwr_clks Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-10-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=3783; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=u0XwnOVdGXgfRiv18KJvoggCPFhhyJzYE8jnecSwHG0=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4QVCgxWG7MQkwYIO2fZmquhIl4W6mSsgcqw QAYfxikpzaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEAAKCRCLPIo+Aiko 1UkvB/0QXhbzvu2Qi7WDnyqqjv7fCAiOPkjQFZ982cDkBIbjU3x1gUpa/ChxkJ+kgfp8UguLOKW Urr3FuY5QKNOH7upYyMF7MilONK8M6VzNEuIRhiO3Oe6k6zpxZQmoKbb9pizEqB1Sv4MGnhh7gC bnW59QObIlD2aXrOnMfsdCQHXsK/T1GB82W9UyUek7nwaEGFCrUIsOzgEaU/gTCpj0XoejKsgqj AsCm3jQdJmcyyaU4gfXFBVE0PMZ0PsCuidADxkTPfL7gtgWMeZJHsfphPLh1BbWu6/QTHLR9tS2 03S0gc01vvsSCpUzwYIYtSlMeoOHmuJwmcTD5PLi71Exy7TZ 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index cc671baad87b..c39a1f3a7505 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -228,19 +228,19 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, .item ## _cnt = ARRAY_SIZE(item ## _names_ ## entry) static const char *pwr_reg_names_8960[] = {"core-vdda"}; -static const char *hpd_clk_names_8960[] = {"core", "master_iface", "slave_iface"}; +static const char *pwr_clk_names_8960[] = {"core", "master_iface", "slave_iface"}; static const struct hdmi_platform_config hdmi_tx_8960_config = { HDMI_CFG(pwr_reg, 8960), - HDMI_CFG(hpd_clk, 8960), + HDMI_CFG(pwr_clk, 8960), }; static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"}; -static const char *hpd_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; +static const char *pwr_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; static const struct hdmi_platform_config hdmi_tx_8974_config = { HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(hpd_clk, 8x74), + HDMI_CFG(pwr_clk, 8x74), }; /* @@ -449,17 +449,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"); - hdmi->hpd_clks = devm_kcalloc(&pdev->dev, - config->hpd_clk_cnt, - sizeof(hdmi->hpd_clks[0]), + hdmi->pwr_clks = 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; - for (i = 0; i < config->hpd_clk_cnt; i++) - hdmi->hpd_clks[i].id = config->hpd_clk_names[i]; + for (i = 0; i < config->pwr_clk_cnt; i++) + hdmi->pwr_clks[i].id = config->pwr_clk_names[i]; - ret = devm_clk_bulk_get(&pdev->dev, config->hpd_clk_cnt, hdmi->hpd_clks); + ret = devm_clk_bulk_get(&pdev->dev, config->pwr_clk_cnt, hdmi->pwr_clks); if (ret) return ret; @@ -517,7 +517,7 @@ static int msm_hdmi_runtime_suspend(struct device *dev) struct hdmi *hdmi = dev_get_drvdata(dev); const struct hdmi_platform_config *config = hdmi->config; - clk_bulk_disable_unprepare(config->hpd_clk_cnt, hdmi->hpd_clks); + clk_bulk_disable_unprepare(config->pwr_clk_cnt, hdmi->pwr_clks); pinctrl_pm_select_sleep_state(dev); @@ -540,7 +540,7 @@ static int msm_hdmi_runtime_resume(struct device *dev) if (ret) goto fail; - ret = clk_bulk_prepare_enable(config->hpd_clk_cnt, hdmi->hpd_clks); + ret = clk_bulk_prepare_enable(config->pwr_clk_cnt, hdmi->pwr_clks); if (ret) goto fail; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index ee5463eb41b6..1e346e697f8e 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; struct regulator_bulk_data *pwr_regs; - struct clk_bulk_data *hpd_clks; + struct clk_bulk_data *pwr_clks; struct clk *extp_clk; struct gpio_desc *hpd_gpiod; @@ -90,8 +90,8 @@ struct hdmi_platform_config { int pwr_reg_cnt; /* 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; }; struct hdmi_bridge { From patchwork Wed May 22 10:51:03 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670766 Received: from mail-lj1-f176.google.com (mail-lj1-f176.google.com [209.85.208.176]) (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 6BB9580C15 for ; Wed, 22 May 2024 10:51:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.208.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375070; cv=none; b=WXPl9GwhNfIsJq40I6KLnUQjoHlYooodAIxatP3cHbUM21q3j3SPq5lWb9K5A78KIY4tfdmocIibC6HhULL2DevluMwYU2+J554nKLU47zIj6gxSTCbLibyRllApfI8B4Z+WRujvMMq8opDQAV3ApPykG/ATSradz4a8GWpyEYM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375070; c=relaxed/simple; bh=5oIxEFONp2G3t75XHmnnmPd77025c+YPgV0mxBOxves=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=iuhQUUvm5QxVCx1b1hifaaD0RqCZZQiNt8LjgdeDYftQhcg/vcmr82Dpf/lT3mbYg/P2Us3HcZxjNUS1MYNy8xIoEV2Uen9GgWs4VlEh7whvgHPm/DCTMjkLrTBJQ/qlyJYhagZosOkF3L8WyUthw8akT4EEJVEC7/tfphi0/kE= 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=Wj/TX9kK; arc=none smtp.client-ip=209.85.208.176 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="Wj/TX9kK" Received: by mail-lj1-f176.google.com with SMTP id 38308e7fff4ca-2e564cad1f6so91462081fa.1 for ; Wed, 22 May 2024 03:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375066; x=1716979866; 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=sH41O+MLWcEGoOFILncrbRDXVEgD8N3mxfmUHLQKrxo=; b=Wj/TX9kKdwRss81wRUIYQ5CRVBcSyNG13UUx1ZSJhnCWBS+bN6Vk9h3aJ+Q8Pkga5O 0jc5XmQCPFDI39hxSLXQ8msI51vGWyK59XOphMCn8juCIE4/bVQnLv7aGmSkOP3Vs7Pz vV4AfxK6o4Ifa9jU3asTDqrLBZlPRmEcz+QnO0ttJru7fIdEkAQQb9jpH6wN9gfbZgDZ xBHTcMpf/MiajyJPqvglRjDHJqDJGwPi8YAnm5UXd2wRLxB/u1yA6PhoaSDewaYjedh/ 7ofZXbMpX4yUmuXmdYYFA57wo+tMbtSpYdr1QANySB+JrD4PVbN0kuIhYyJjS6M2dTyq +PUQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375066; x=1716979866; 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=sH41O+MLWcEGoOFILncrbRDXVEgD8N3mxfmUHLQKrxo=; b=kGUOwDWuBtUnQw9mCROtdrZoX02FzupEF71sY5/buTA+sGeKwl/yVnQ/7/etlXXvzR JpvoeN4LCjAP/bJPTcL1TZsb4+EMtfzNeDnpitkvWSrp1FURuOmZu8cJcEHZwmJtwh6J EYX7DdehMzJHg4tfmdUJ6BjTdu9J+4UmD12g6fi342bCDJEIocXCgsavDjzA/2zdpNqv aWEVqn3L2VyG4y1RiDGGUOezUkQHEXePztcu+QV2CDXz7TWocDjy0lNhRwSEdUMAeB9Y SOM5FChvAeOht3RY09FNcR5SgxFhrPBNTXUDF/ZCr7P8Xe0lkFDerBzSFH5ImueoVTvE 0eZg== X-Gm-Message-State: AOJu0Yx8aIPJ7viuWQZRRS899rkpY1f6GP9WCyNK5dx+0VGkTTSTveli ukGE6vSCE05oQscLBEuKTS2+bdz6r+Y/U8a/4K8Nox3QTaOgKdFd/IL4FSul3uI= X-Google-Smtp-Source: AGHT+IGCxr96bjX8x1MG+g9F95qGyDTdggpyJqocrQW/lh29CygQ0vqX1n7hNrmg1HrGHeu4jOLkDA== X-Received: by 2002:a05:6512:239d:b0:523:6354:881e with SMTP id 2adb3069b0e04-526bf82d6ddmr1341359e87.39.1716375066683; Wed, 22 May 2024 03:51:06 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:06 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:03 +0300 Subject: [PATCH v2 11/14] drm/msm/hdmi: expand the HDMI_CFG macro Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-11-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=2180; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=5oIxEFONp2G3t75XHmnnmPd77025c+YPgV0mxBOxves=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4QI5yArcsRgIC1Y5yDdP4FZ3iATW4eltThT TQdTVy+bJiJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEAAKCRCLPIo+Aiko 1R0yB/4m6I8/Jn6RfH4DWx6uVdIDZq8+GTkaMxoun5+Z75RRwIBgaFMUeP+IcJTMIJrdQqZ4elt DwLqUTU10+3iq8msyPPUrOm168PRnHpiR/R/z9bpquMLQ3folJJy8ss20tOqwdO79yCGJNDm7kj /lTzIDraU6Yvjrkzp+lkWsVn50eehgungQNNl/0t695TOt4CfwGMUXFCJKhFNetbYeOb6k/tvgS eXkuclZcuQztNyXp+W4JlYGEquZT85pNDH5RtTLW+DcsXEH5J0md45zD9mArVGIgNMMbnHhzvCe g5kUTL/W3PO+9QdbjRUczy9tvLveerr/9GEBVQYOASrvtXLR 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index c39a1f3a7505..e160a23e962e 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -223,24 +223,24 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, * The hdmi device: */ -#define HDMI_CFG(item, entry) \ - .item ## _names = item ##_names_ ## entry, \ - .item ## _cnt = ARRAY_SIZE(item ## _names_ ## entry) - static const char *pwr_reg_names_8960[] = {"core-vdda"}; static const char *pwr_clk_names_8960[] = {"core", "master_iface", "slave_iface"}; static const struct hdmi_platform_config hdmi_tx_8960_config = { - HDMI_CFG(pwr_reg, 8960), - HDMI_CFG(pwr_clk, 8960), + .pwr_reg_names = pwr_reg_names_8960, + .pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names_8960), + .pwr_clk_names = pwr_clk_names_8960, + .pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names_8960), }; static const char *pwr_reg_names_8x74[] = {"core-vdda", "core-vcc"}; static const char *pwr_clk_names_8x74[] = {"iface", "core", "mdp_core", "alt_iface"}; static const struct hdmi_platform_config hdmi_tx_8974_config = { - HDMI_CFG(pwr_reg, 8x74), - HDMI_CFG(pwr_clk, 8x74), + .pwr_reg_names = pwr_reg_names_8x74, + .pwr_reg_cnt = ARRAY_SIZE(pwr_reg_names_8x74), + .pwr_clk_names = pwr_clk_names_8x74, + .pwr_clk_cnt = ARRAY_SIZE(pwr_clk_names_8x74), }; /* diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 1e346e697f8e..2a98efa8b6bd 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -89,7 +89,7 @@ struct hdmi_platform_config { const char **pwr_reg_names; int pwr_reg_cnt; - /* clks that need to be on for hpd: */ + /* clks that need to be on: */ const char **pwr_clk_names; int pwr_clk_cnt; }; From patchwork Wed May 22 10:51:04 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670768 Received: from mail-lf1-f42.google.com (mail-lf1-f42.google.com [209.85.167.42]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4E57B84D0E for ; Wed, 22 May 2024 10:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.42 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375072; cv=none; b=kl9TEhqIQx+8/za4eSX3aiezBM7lulWJVKl0dFgNvqPKAm1R8zfybZPonqTY+A4vg1W4lF6ZiBU0kBmMsbG/096Bjn6XpcriSa2leUY2baSrZLob0V5Szh14Y7AsalM7M7yu5fy2ssRyFxYCI2DYm92sMm/rVVyW0dWVMu8WByM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375072; c=relaxed/simple; bh=+CX0caTW/kgZp6WyPrwa6tsFcNkT9AW5y90XnvQROQ4=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=A8HOLQy2Gy+sBinwfVdr+6SJKRkwJvtNTt7NcQ5F6CsIFPxi3uhnh9jSgLpWEi30k+sixmKaUKPa2xAwFvpH/PCymVlLR95g5Q1oR5Z8w+qhoWn+0yZRhuwgadT7q/Nnc06RhDfAnt0keeKqoDhtrmlI9ROGLpkiC705XEgksH4= 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=OOVqqLvT; arc=none smtp.client-ip=209.85.167.42 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="OOVqqLvT" Received: by mail-lf1-f42.google.com with SMTP id 2adb3069b0e04-51f99f9e0faso7580332e87.2 for ; Wed, 22 May 2024 03:51:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375067; x=1716979867; 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=wqy3Nq/FVqz5cSsGbuupU45qtEw4OAV0P+mpABZ0QzY=; b=OOVqqLvTa93aT44KMlo/MprjDF2jjcXQMLMukXqW/BdzkMXGBB8iYkJg3Xh5L+ZTWW 2UNt9gsHCOrYRqsz/XTsjRLhHFcEZKylB1IfMahjKV5Ge/q4W0RFh+CL+b+ydcQFyVrD jcmjFXN+yyQ4S0psjqVgyLCcO1RiLhnUJ6qUNRePJcgRnuEavjJG0BLi+bwbly6DXOzl qp74+ZZJhmQR0YOCCwjNUnlYGqnHm9MbG7HpT77xdU/b0UJaul1MAmz8KdHFPkfQo3lU +YvimlBPbniU5/dwgN4x5S2epwDj0lKTHUKaG8o+HLQo6x0G/K5H2sFwXA5JMoDPMlnm MQZQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375067; x=1716979867; 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=wqy3Nq/FVqz5cSsGbuupU45qtEw4OAV0P+mpABZ0QzY=; b=sXzUeRipDIx+bviRsNppQbkriuRNxcTk5xiGAzw9BlJ+V+9ePzI/Z82atIwGUHU+Wn Ed8lrZ2B14n1aq6rmCNCpuJWOFZaRMozxaOyYBNHpiGaCBwUFO/u15srdbVKefKZxXrq lELhRKOrot0RIkrLARHukKOP7jL5VrVfcuHO8j1gMuJxnXPcjaZ9xCXIaO8X0jqFH40O oin5E8kRj2YRCA8bN4LYsUP9mPOjLe6uQLxdK/XmT/oxZ8fJSAe56xhi81InPqe/CwW9 CIxhxgKYzn8cD+Q3nz6NmGiY4BAngXSX7g6/SLWmJDBKThJ0LYhCAVSvu/k9U5dqTtg1 9bWw== X-Gm-Message-State: AOJu0YwPqVVJtb4Oieim3XaAe6TvX1gqdDQyQP9dISTa2iF8rzCQmHNn qZXhFNlZ3FaxeAWY3M6Aa7cK4yJKZapswZ6TNSgJJl4Wk0wFO+qznIqCrFOSboI= X-Google-Smtp-Source: AGHT+IHgBR6IZsd/oD+qVsjGs90/sjJcSsviftKInsNc+Zspk9Ki5Svqna+XEj1d07VSv/zTMZKS2Q== X-Received: by 2002:ac2:4650:0:b0:523:b261:3dde with SMTP id 2adb3069b0e04-526be210a62mr1072706e87.41.1716375067512; Wed, 22 May 2024 03:51:07 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:06 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:04 +0300 Subject: [PATCH v2 12/14] drm/msm/hdmi: drop hpd-gpios support Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-12-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=4311; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=+CX0caTW/kgZp6WyPrwa6tsFcNkT9AW5y90XnvQROQ4=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4RBfN8d+WWDxu9Xpu1mwywXrVcB/Zvb1Dt5 CqWSyTK8umJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEQAKCRCLPIo+Aiko 1df0B/0RzAIL6g568vkZbZkPLb9FipJP10RMJLky2EpTE5cL+q8WdmEQ1VJnepz2WWxQS+gG6vS a2SxV9T7v0unXemRNdHQD5m7kvc9HZu6Y0w16kaRF0rn6i/qWCCy2YSF61jn/nbbiWhxUfYUI5x 6TT0PPjqJZSz+i6eOAkd8hZmb4a4Xu+bbvma7uCiEhQ9ti6xkqx8PqauXeen77BusXSY3K09cph t/QhkXG1CE0lK43fpgBd0QQzaqxsvw3ys5SDImQSzwAeAuooAo74CMS4Qadtoc2i1SinufzahFy BwfKekG9BMpvo3c1PLRp0GZFg//2osKqBG6HkAa18M9NQVCs 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index e160a23e962e..a9437054c015 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -468,17 +468,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"); - hdmi->hpd_gpiod = 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"); ret = msm_hdmi_get_phy(hdmi); if (ret) { diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 2a98efa8b6bd..268ff8604423 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; - struct gpio_desc *hpd_gpiod; - struct hdmi_phy *phy; struct device *phy_dev; 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; - if (hdmi->hpd_gpiod) - gpiod_set_value_cansleep(hdmi->hpd_gpiod, 1); - ret = pm_runtime_resume_and_get(dev); if (ret) return ret; @@ -144,8 +141,11 @@ void msm_hdmi_hpd_irq(struct drm_bridge *bridge) } } -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 = to_hdmi_bridge(bridge); + struct hdmi *hdmi = hdmi_bridge->hdmi; uint32_t hpd_int_status = 0; int ret; @@ -161,48 +161,3 @@ static enum drm_connector_status detect_reg(struct hdmi *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 = to_hdmi_bridge(bridge); - struct hdmi *hdmi = hdmi_bridge->hdmi; - enum drm_connector_status stat_gpio, stat_reg; - int retry = 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 = detect_gpio(hdmi); - stat_reg = detect_reg(hdmi); - - if (stat_gpio == 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 != stat_reg) { - DBG("HDMI_HPD_INT_STATUS tells us: %d", stat_reg); - DBG("hpd gpio tells us: %d", stat_gpio); - } - - return stat_gpio; -} From patchwork Wed May 22 10:51:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670767 Received: from mail-lf1-f51.google.com (mail-lf1-f51.google.com [209.85.167.51]) (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 C7A8484D3E for ; Wed, 22 May 2024 10:51:09 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.51 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375071; cv=none; b=tRtSwkEUf5wJCJVY3YP/ZCQCKBhyu7/sx/0oqGjxWPM+CZoOOpHs6Xxr9y5xZC2Y7gSJLtwhTQ8KTaTtrJn0Le3g1aYltKlfDOwj8Ym+fPquDCsYZwd5cxPFOzHV1CIB75IntxgNjMbDjIN8NeHfjypEtYUbbmzvkAboV6r57NM= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375071; c=relaxed/simple; bh=fN+A3/6vCyYk379OydAiduI6v5ThmuLGAylNRut8Q0Y=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=XbHwyGZuHi0D7lkmc6NZhdLV6mU36laJvf39Nl+Xcpb018r6iaZAqI7iJWXdUD6HTNs92YKBorD3gjmDlHFwvcM/ZK+PVsGBuP1HfGn38f2TRAzEO49Ydz6u4aVCRFGxqRZ/Lwkr+nTszLmEYhbm9sIW6Wp+fmC5Ik01rAoK804= 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=lcrFIY3b; arc=none smtp.client-ip=209.85.167.51 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="lcrFIY3b" Received: by mail-lf1-f51.google.com with SMTP id 2adb3069b0e04-5206a5854adso5464150e87.0 for ; Wed, 22 May 2024 03:51:09 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375068; x=1716979868; 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=kQt039iK/MLUHKrg6kdB48KBLBfk/G02HtDymVf9/cs=; b=lcrFIY3bS3ZxBTvyycSzuQE6zBdzZEytlpFNNw/FUjrRDXBTedjg9GOLQnrp3vvvmU rRXcX8gNAPJWktAjCKViKW2arA4o59tx0XvJ4sqgoK7lKw/Qn9K0e80/9fjgRbF86YA+ hn4uLo0XoLZveeRCnrRzb1LiLnOC2M7uj8kZasip5h8fxzkdaQSKToADl4Vg9SvGSNzr y+1UTzL1sEG05dR7CukUFPIxuz4rxIyuzpt8p1jvgB0UP+8+hk5iVlOyE+sNO2mBC9Ap sxIatAdnyllrry0er9bCJyw4ckrgklO+QCQXiO2+St3iLg+RhKhUSIN4yu4S1A6zuIMP FBow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375068; x=1716979868; 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=kQt039iK/MLUHKrg6kdB48KBLBfk/G02HtDymVf9/cs=; b=bT/ioFjRFH7pFa58xs455e698f1yo7bZbo5Vj6RH8qRVRA2S8nPxRwpvK1HEtM8yxY Oeqejjw/K35ZPmGRPLygN2628Urin9EcoUrcqbhFlCkgCl3JYcGmhdviOFSSQJ3Y2hI7 3iNXSEaEUtRDyhObcQ4+tZjjGCFqrWQTJLfgR2Up8Kjg5hsF6Ms1rnf/SOM9TXxD8wSU PTCQGTZfkoJeIIMX+1BzVxsZiewJktx/8A/o2MRFG10dOGCTH9NaHJqyIUrg4M3ILX51 IbID5NOHfNxMx9DJDmi97kAmkEBN2vkUM6kDWPe77eJT/xZoOV78WuPSYsdTNXJxqYNi 3GVA== X-Gm-Message-State: AOJu0Ywxkzdt9WFyLgRJYtDmfehZAkRlYB5OXydC1xPff4e5f1Y749/W /JTiIohuNsIF2FDRZdAgt0IVhurgGgCbyuuNvHfP/C8QrMohl4YMr5t+xmg/sFg= X-Google-Smtp-Source: AGHT+IE19pPXGyC8uaae6hqcH2EPzGBxyhrTv79BSBeUBvyS8uz/EAWUerDg6ffy+uQkeB6O0oM3xw== X-Received: by 2002:a05:6512:3707:b0:523:d1ba:6431 with SMTP id 2adb3069b0e04-526bfcf72d6mr829466e87.66.1716375068296; Wed, 22 May 2024 03:51:08 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:07 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:05 +0300 Subject: [PATCH v2 13/14] drm/msm/hdmi: ensure that HDMI is one if HPD is requested Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-13-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=3672; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=fN+A3/6vCyYk379OydAiduI6v5ThmuLGAylNRut8Q0Y=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4RpzFy/RBa6wu+q9FeHDiKrwkox2DFhaeHF 4v2WsPp4GaJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEQAKCRCLPIo+Aiko 1Vh7B/95PEKsWeIEL8mDIfKMXBJryYqmCBX/RF1wUhr6eSzA/642guxhiuaaYf6UpvEodW9nitX B5kvWRDkiDFyZy65fYhKFZ+9HIC8VZdpA6iR4/OHYwrV8FuvaljFy1tvDz9VvpkfCgYxN/HfTvc dflfpD25FK19tPRsaer+FbKMFcNqYmLpo6ta5ZrNMw2LPHsPAPfW8JBNOBgzw2USJZ59EOqNAR8 XeJteZAPLcLS5o0EUrRYn5ob0Z1oCVT8Ksa26Q6HZSKEXedF/V20TD4ByYIkW4CHQHCnM8MJx+G hSkEKjEqMj5dmZ+WNiuSzZHnvnwFadD6TI4pJFEh+6T2uBLZ 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- 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/hdmi.c index a9437054c015..2890196857f8 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -409,6 +409,7 @@ static int msm_hdmi_dev_probe(struct platform_device *pdev) hdmi->pdev = pdev; hdmi->config = config; spin_lock_init(&hdmi->reg_lock); + mutex_init(&hdmi->state_mutex); ret = drm_of_find_panel_or_bridge(pdev->dev.of_node, 1, 0, NULL, &hdmi->next_bridge); if (ret && ret != -ENODEV) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 268ff8604423..7f0ca5252018 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -42,6 +42,8 @@ struct hdmi { /* video state: */ bool power_on; + bool hpd_enabled; + struct mutex state_mutex; /* protects two booleans */ unsigned long int pixclock; void __iomem *mmio; diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index cddba640d292..104107ed47d0 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -117,11 +117,13 @@ static void msm_hdmi_bridge_atomic_pre_enable(struct drm_bridge *bridge, DBG("power up"); + mutex_lock(&hdmi->state_mutex); if (!hdmi->power_on) { msm_hdmi_phy_resource_enable(phy); msm_hdmi_power_on(bridge); hdmi->power_on = true; } + mutex_unlock(&hdmi->state_mutex); if (hdmi->hdmi_mode) { msm_hdmi_config_avi_infoframe(hdmi); @@ -147,7 +149,10 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, msm_hdmi_hdcp_off(hdmi->hdcp_ctrl); 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); msm_hdmi_phy_powerdown(phy); @@ -158,6 +163,7 @@ static void msm_hdmi_bridge_atomic_post_disable(struct drm_bridge *bridge, msm_hdmi_audio_update(hdmi); msm_hdmi_phy_resource_disable(phy); } + mutex_unlock(&hdmi->state_mutex); } static void msm_hdmi_bridge_mode_set(struct drm_bridge *bridge, 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; + mutex_lock(&hdmi->state_mutex); msm_hdmi_set_mode(hdmi, false); msm_hdmi_phy_reset(hdmi); msm_hdmi_set_mode(hdmi, true); + hdmi->hpd_enabled = true; + mutex_unlock(&hdmi->state_mutex); + hdmi_write(hdmi, REG_HDMI_USEC_REFTIMER, 0x0001001b); /* 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); - msm_hdmi_set_mode(hdmi, false); + mutex_lock(&hdmi->state_mutex); + hdmi->hpd_enabled = false; + msm_hdmi_set_mode(hdmi, hdmi->power_on); + mutex_unlock(&hdmi->state_mutex); pm_runtime_put(dev); } From patchwork Wed May 22 10:51:06 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13670769 Received: from mail-lf1-f49.google.com (mail-lf1-f49.google.com [209.85.167.49]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B5BA384E0E for ; Wed, 22 May 2024 10:51:10 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.167.49 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375072; cv=none; b=t/CeM1Dh2f2gfPtDtKNPWuYP3meMdP9/Li9UNaEsSWWxxG2tDVX4sawGzHJ2eR5+KHn4clJEuCvJLSrN15f09p+s/5VJqmoquhMt6/702ZW3l/8nD5sx8nT09oft/LGX8l9cDml3ehAlGNZwcCr9JYhcE4rV6p32EGZWT8QLwgA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716375072; c=relaxed/simple; bh=/wrNOYlvXzRdTeplf6TZbVC8so7rhZlXjnI2QI/al7o=; h=From:Date:Subject:MIME-Version:Content-Type:Message-Id:References: In-Reply-To:To:Cc; b=rq/KynuPFx3jxXvQzsTsJhWHoRqds3ynXPmBLZohYKka3zhVTDpziE/WHbb9jfe4hMzXFT2UEAlJlOyysqEiDR/v6WNet/R9YMGD98YFtclqOxOOYnor22/7K3+gh9ypwi0K/JM6C+3B9J/fwXCLeRbHOeiwfIfoEs7QprYRg3k= 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=Tm8MlPwx; arc=none smtp.client-ip=209.85.167.49 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linaro.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linaro.org Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="Tm8MlPwx" Received: by mail-lf1-f49.google.com with SMTP id 2adb3069b0e04-5210684cee6so6655936e87.0 for ; Wed, 22 May 2024 03:51:10 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1716375069; x=1716979869; 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=j/4fTIJgTEUbDdUM7ulateH0ttYK2JMK4XIQQRpRwck=; b=Tm8MlPwxK1nypOUAwjlRF+fzLS6TkOxfc0zK4sjJ8zqu0yR35mfz/AdQ/j/DSK6p5k XnNTvUzYu5JdBFLWhQSsxZOKzSpSULk/Dpuj60BgTnOXEhnHvv1NUTE63wIxygCVNKac qW0cIQw54KLEnQKwTJPBO8f0pmRb5vGdwoxe04uSo/tC6GMZOzZiUeGBD44G+SWAfR0/ A6pBlhCskhJML7SUB4YrYmaJgI3NNmTvnqWgoSEJBTmwPG12QnVAsRGWzNcrRKfSDffJ 30jkjgMOayXP03JwUsm5luHPCREXfeASLCkIdEtjGm11G9PQUy7wMNUXhpuJXKkHSatc LVsQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1716375069; x=1716979869; 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=j/4fTIJgTEUbDdUM7ulateH0ttYK2JMK4XIQQRpRwck=; b=Ktr38uyrJL6p33OGc5HJERH7t2NxLzyf/xUB4o52DL0RcIy5H9a/lkqFI2bDKAc4na iFcmAENfsnFV8IGm/E8akgi6epawOlgNzzWxzdl37fqk3M54kzx8xwBx65d3gdHklYaw H1xOxOMYeBvF4Rs3Lnb+fk8UHH2sXGaDOJM0vicAqypJzNKCK5x0BVy1lL+HOtFPAlZo piGESWLEWNC4VlVYgm9xQGylLi9bBctfj7bD/wfgpMC2U2ggfOxE+7VFvuKNFP9C439U mFzf531QC+mQQSV0gF1BjDeIy5dOXvnuuJYydxFiuPJa3/EMTGqYpkcGY+UJL0Nf92oS SzPg== X-Gm-Message-State: AOJu0YxE/yT4EUyINIScJcqzoLTMLqUpRlMV47atZMAd/xEjVu0W17Yd wYCL5kcnPkzaidYbu3T2yasIVqLiZHaaYmCCCAKq8J7ebwspYAJB9TEreMVnSjM= X-Google-Smtp-Source: AGHT+IELruHphQs1lHT+YJc17lZvFaGsZaIttRkKgj/276EsYqWN2Z5w0oVEWecTGdEVYJODT/Hf7Q== X-Received: by 2002:ac2:4c10:0:b0:518:95b6:176f with SMTP id 2adb3069b0e04-526c068ea7cmr892773e87.50.1716375069078; Wed, 22 May 2024 03:51:09 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id 2adb3069b0e04-52431778ec8sm1279126e87.194.2024.05.22.03.51.08 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:08 -0700 (PDT) From: Dmitry Baryshkov Date: Wed, 22 May 2024 13:51:06 +0300 Subject: [PATCH v2 14/14] drm/msm/hdmi: wire in hpd_enable/hpd_disable bridge ops Precedence: bulk X-Mailing-List: linux-arm-msm@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-Id: <20240522-fd-hdmi-hpd-v2-14-c30bdb7c5c7e@linaro.org> References: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> In-Reply-To: <20240522-fd-hdmi-hpd-v2-0-c30bdb7c5c7e@linaro.org> To: Rob Clark , Abhinav Kumar , Dmitry Baryshkov , 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=3864; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=/wrNOYlvXzRdTeplf6TZbVC8so7rhZlXjnI2QI/al7o=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmTc4RYwSU6lOZZB3KG7aLp6Cx2FiLEgfA/chDB bge3K0A5YmJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZk3OEQAKCRCLPIo+Aiko 1Rb7CACP2WFe3WKMzifDnF7L4BKpX8QNHIRZOX8BsKiod/n3IIa0usUDK3kAMOi40/U6TyKOcF6 gqRv0D03gJMhCARcSsXKbPIjk9mKtLJlLumJGkKiVPY0MQm9hcxsx3atkHilZU1+XycaOMjW+dL YiHeo+COVv47oNf0ETJY25YIWK6DjkFxuYeG7F2zeK1ahF5QrIl64FxN3M73Coj/yQjKdjJUM4t AP4boZhBwBi02kTxoxEr2BrrrJDYNMPuS79LPR07pI5yHvcALXo3VUzqIZLAa75+VXuG8xZ3dsQ Z3hQXnUujcst+Q52pd4hGrHQe+Qhhli6fsO0wgDUt4l1owTm 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. Signed-off-by: Dmitry Baryshkov Reviewed-by: Jessica Zhang --- drivers/gpu/drm/msm/hdmi/hdmi.c | 9 --------- drivers/gpu/drm/msm/hdmi/hdmi.h | 4 ++-- drivers/gpu/drm/msm/hdmi/hdmi_bridge.c | 3 +++ drivers/gpu/drm/msm/hdmi/hdmi_hpd.c | 12 ++++++------ 4 files changed, 11 insertions(+), 17 deletions(-) diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.c b/drivers/gpu/drm/msm/hdmi/hdmi.c index 2890196857f8..06adcf4a6544 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi.c @@ -202,12 +202,6 @@ int msm_hdmi_modeset_init(struct hdmi *hdmi, goto fail; } - ret = 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; fail: @@ -377,9 +371,6 @@ static void msm_hdmi_unbind(struct device *dev, struct device *master, if (priv->hdmi->audio_pdev) platform_device_unregister(priv->hdmi->audio_pdev); - if (priv->hdmi->bridge) - msm_hdmi_hpd_disable(priv->hdmi); - msm_hdmi_destroy(priv->hdmi); priv->hdmi = NULL; } diff --git a/drivers/gpu/drm/msm/hdmi/hdmi.h b/drivers/gpu/drm/msm/hdmi/hdmi.h index 7f0ca5252018..c6519e6f7f2c 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi.h +++ b/drivers/gpu/drm/msm/hdmi/hdmi.h @@ -219,8 +219,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); /* * i2c adapter for ddc: diff --git a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c index 104107ed47d0..41722b2e6b44 100644 --- a/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c +++ b/drivers/gpu/drm/msm/hdmi/hdmi_bridge.c @@ -300,6 +300,9 @@ static const struct drm_bridge_funcs msm_hdmi_bridge_funcs = { .mode_valid = msm_hdmi_bridge_mode_valid, .edid_read = msm_hdmi_bridge_edid_read, .detect = msm_hdmi_bridge_detect, + + .hpd_enable = msm_hdmi_hpd_enable, + .hpd_disable = msm_hdmi_hpd_disable, }; static void 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) } } -int msm_hdmi_hpd_enable(struct drm_bridge *bridge) +void msm_hdmi_hpd_enable(struct drm_bridge *bridge) { struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); struct hdmi *hdmi = hdmi_bridge->hdmi; @@ -70,8 +70,8 @@ int msm_hdmi_hpd_enable(struct drm_bridge *bridge) unsigned long flags; ret = pm_runtime_resume_and_get(dev); - if (ret) - return ret; + if (WARN_ON(ret)) + return; 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; } -void msm_hdmi_hpd_disable(struct hdmi *hdmi) +void msm_hdmi_hpd_disable(struct drm_bridge *bridge) { + struct hdmi_bridge *hdmi_bridge = to_hdmi_bridge(bridge); + struct hdmi *hdmi = hdmi_bridge->hdmi; struct device *dev = &hdmi->pdev->dev; /* Disable HPD interrupt */