Received: by 2002:ab2:7855:0:b0:1f9:5764:f03e with SMTP id m21csp256127lqp; Wed, 22 May 2024 03:51:42 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUd60KgTnyXK9AyhUhG3zGOR02F447Pc/Cjos2d/9QhySWjUetprJAO3AJXu8J32dqsMpDW28Zq5hfHpLeT6yxhlLxqcRLGLIVANGRobA== X-Google-Smtp-Source: AGHT+IE7Mf9nzH1XH4p8YsDw+zNNY0nZQSPAWZBbcBI1HsCQhttx/+T71tTn8pOzExPa6lvjOgzk X-Received: by 2002:a05:6a20:5b19:b0:1ad:6c5:4ea1 with SMTP id adf61e73a8af0-1b1f8a8bb4bmr1548010637.41.1716375102393; Wed, 22 May 2024 03:51:42 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716375102; cv=pass; d=google.com; s=arc-20160816; b=q8ul4D6PQvlpRwx0kVFlNC/6EKk2P8i2yQH5aALnBArlxnPnul61ONHA/61tM6y+0H Zv2l+bYZo5x8ne0B+ksmSd3eyndL60kJj2t6oJDKZwjDit8VcO5ezzsxKf8nHf7GmsDm tjheav3NFEbhWR/Wl4iHcfKYTs+eEDdKZvL/gWRjO/XQe6jEj1iyTw9ky1jsO8X6Z5gn lZArEYHihdGpjISCQnvXE/FDy2shnAE6Tg99h3Kf+wDcO83ej9cTzjBsAtoV69RJNLEJ 9RET5UlKSfv5fw6QSZBEz/01srDBGlA7wNscVLM5ALlq16wyXiucz0U4vZzUURSHtGAa K51Q== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :subject:date:from:dkim-signature; bh=/4mDJNdY3BQpBxyPjIYj4R7zW531FPYbhtqPnKZkd9k=; fh=hFk3j93so4Pe7CmN47wY0iu+/XoGBcA7QyX9mD94Tyk=; b=dxajMnvmtCTbWbrxEbQ7Cts6gHubld4ZYTM2EqXY7jxVo//ZCmEjyuiFcGwTq4PQgc z6dLTr+wMZyIv1XShcldTXcT6yp/2YYXCDjDSwFgbd6dCCBrakghx1XxxAqQ79OtV2CY iRfoGhduAMfdZpCnEHBSJVBd8xVVqFBNXM6xb42PYPhl62CtbFFfcSjrJuvKaJlHjK// s6iXtUX7JxCW51+0c5gAbNvH2FnMEvI9rFyXkpN8pe6gyxTboN4zeC4Tx041XYsiyhWy /rGy6qC78dcF7JonD5h5ZhzDWAf4YvHdXghRyw/MUgN03oILAjCD2qZvYG0c6qyF+Pl1 73Yw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FzTmBHlb; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-186073-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id 41be03b00d2f7-63409e82782si2335557a12.86.2024.05.22.03.51.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 22 May 2024 03:51:42 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-186073-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=FzTmBHlb; arc=pass (i=1 spf=pass spfdomain=linaro.org dkim=pass dkdomain=linaro.org dmarc=pass fromdomain=linaro.org); spf=pass (google.com: domain of linux-kernel+bounces-186073-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-186073-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id F05E028360E for ; Wed, 22 May 2024 10:51:41 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 39C7E82D72; Wed, 22 May 2024 10:51:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=linaro.org header.i=@linaro.org header.b="FzTmBHlb" 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 92271811FB for ; Wed, 22 May 2024 10:51:01 +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=MTnjHYPy26HW/Rzj8Zqhk6FenXZeAYeTniP0cvWQu/3mBnbmjGMDMARegkNQx2FNB07u+KopStB2O61QPLE04MqYhrMalNtpjAQNjXo1yvEiJ/aZ5qiH1ydncj1fBJVfGnvDpE7qwaeLXY7rTdjMTFO9MN9p+RkXFaH49TQGz/o= 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.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 Received: by mail-lf1-f47.google.com with SMTP id 2adb3069b0e04-51f1e8eaee5so594818e87.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=qdhsFPjaUkL74PxySifX04ekBI+D/3i2eZd+1zHPiWnglqyaw2VBj41V6HRBIZ0xbV 8g54atEC11ifHL/hzXVFA0PSiFGks/Chawi+rYWnM7NhrNtYpLmu8rtQLlfXt3Q57H1x QYteAkjpb+hmaex+swrrPtlCeYXEOm6zEG1FIQgA1JQg8y0aQ9usdmVAtqp6FXYAdoaV 8N+7/G4KJyeacbZt44NWzAMfyA8LEhvhuWMz/J15RnG5oMPjPUbgNnfhnZCHL0Zce93y lxBplsiacKz7sRlRa+j88xlNSFIuEpKWjMTfuLx5RRL2LyV7hG+iBjjtxN4bV2pc6wMU FHCg== X-Forwarded-Encrypted: i=1; AJvYcCUei+gEv9yOhW8IeGxfRwXkSlUsUXoOcvY/PAJjFMkFIhqjD7qz928PlrZkor6TaJYAH567MST4m+NyLe4lhDB5FEQGAgPaFbnHf2te X-Gm-Message-State: AOJu0YwDyh/Iplp2nBP/OnZXB6J3XGbc0zaoh75Oi9DHeFOTha7f5rjH sYGZOkkXSLN3pfVu5LQCqL9EXmU88NeHIg1v/PancCQDDVnx/sAlUuNDusYlh8nKmZgjO2iLcxS Y 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-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit 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 --- 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; -- 2.39.2