Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp3445116pxb; Sun, 26 Sep 2021 15:46:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzkk6ABwRVNulNjkmiSxnalcFKY1v0AoFfXRBBM9O4yg63v6FtVDqsRwAouQ+Z3QUiqluFU X-Received: by 2002:a17:90a:4b4d:: with SMTP id o13mr15759402pjl.236.1632696374950; Sun, 26 Sep 2021 15:46:14 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1632696374; cv=none; d=google.com; s=arc-20160816; b=XoJVB0DSQzM6d8++yTAbaTJRK9YS0WIeScvOh9gL3+2va7fC8GczycGEdulEL7Xfab pdYSZ1qo3ZD2tKbnX0nwMBGPDLWeN43EnfTZ1GLKhC/KSB0ALYWR67Bur44A+BeUxfuB mC1akWVSsFvXltgrWhbas5T2u2dAIohSCyDUaPDln8gnnQ78d5pxd7siiQndhng99Tu3 HELqgxpPEob9gM8PD5yiczw+OJuK4oGF971x56YuVe6dHGpoeRDuEkkql1cw42lZPlEI JGu4J9oT/XVfqsKtPHf0aGksYuPvmluacipUI9ONizKb7m7+Q5c7FNzYzOGNAPl2rHwX ATjg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=31z6ju9IxXkuW5YuopLRzoIoj/otNjt9+lw55F7t8U0=; b=wde0bbBQIMB6xu0jVKhTjlq4ZgAWa7FLz5DhvyaSZwJp7dpRYtN6i+5MaJgRM3oBAX fQrOA6M2APDIK8KpjbpWEBwFXsi5ZUCIOxSWqV+rfIi56Jp593eVdWW1juZhqEmtrio/ xHzcgK/5Yak7dpYr/8WmHVBpRHUVW6ou2Ut/esb0a4k+BQJrcI9BPqtEMdrdJCYG9qt3 Hd8vAaviqSbdE89i/bAIMMWqjxsRhQLHnsnSRHaCbZfj4kgpeeqSa12z5UZiYp25HWRx i43rzANH25CzR3ricVSdT4TtIj7f5twCcld/kZ7yqTej5ZQku/Hn/EZyav8/xy6joQZl rcKQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LLfiLqLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id t17si19395165pfc.264.2021.09.26.15.46.02; Sun, 26 Sep 2021 15:46:14 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=LLfiLqLR; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232808AbhIZWqY (ORCPT + 99 others); Sun, 26 Sep 2021 18:46:24 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:43352 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231660AbhIZWoS (ORCPT ); Sun, 26 Sep 2021 18:44:18 -0400 Received: from mail-lf1-x133.google.com (mail-lf1-x133.google.com [IPv6:2a00:1450:4864:20::133]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0F9CC061570; Sun, 26 Sep 2021 15:42:41 -0700 (PDT) Received: by mail-lf1-x133.google.com with SMTP id y26so29087723lfa.11; Sun, 26 Sep 2021 15:42:41 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=31z6ju9IxXkuW5YuopLRzoIoj/otNjt9+lw55F7t8U0=; b=LLfiLqLR3Uv7MtvTYWmjc+gcUe3dYi7j5vfpS6/nXEonrzdADV499jnt5g3VHYmD2P IaJ9zQyJW0W//HcMG4bBA5YT4Fr5lc1ID60Ts+UOEA9GovTWKNfpdh0YDJCPL44Z6Fg3 fJxIp994pumpxP8I7tQp1FOAcJkOoFY2+usFlO+SvVbk1/LGRkkmiMG3iaGgF4UAC2ql 0Ri9qBnHW1OOaczmHUjlOfjPGmyKdENaX5Dw0spWFIN7YfCE4HgZSBe2T0njdEUSsEJZ nuNGVhBSXtbuozBRSxrfynWwPezZ2KvPJ2V+KcepW/7yyNDq4dqvqfngbeBJJgDmQpw2 /6DQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=31z6ju9IxXkuW5YuopLRzoIoj/otNjt9+lw55F7t8U0=; b=ld1o450rbkkDSbhPNs0GuNbjkj3ULRsbVhLLuk+ZGQelRIcvV5hl00+T8L2vIqoWL9 SjWSoGYNhigl5oG5NR+IZeNsR+8B58onLusLUeYplvCKugTWwrMt9OJoMApiFqpAbAVx 1BfQtoR+DfWAa5dBHBfrWQWh/pH8j/RPHTfyKCNIGL55HAu0YBbYD6/Dy/ldVUbg7dsM YTkGGcKYpzT/Zcfu3C6QvEXxzMh0K2RktBlKnU+vJy/aJDBLhI5VimXZhP6LUU9NX5HR An+nHYhzTagu7nCwDTkYIPprq/dJG7d0bqljaM1g7hEXwIVqkIm+uYlqs3CbRP3zy+9M 6TVw== X-Gm-Message-State: AOAM5305hXk9egfJmo9C04VA03a7R2fOmyvwMdE6a7tg3A8t9xNMUbux Ur34HjNCsy1FTUu69dh+r98= X-Received: by 2002:a05:6512:3c92:: with SMTP id h18mr20860545lfv.656.1632696160164; Sun, 26 Sep 2021 15:42:40 -0700 (PDT) Received: from localhost.localdomain (46-138-80-108.dynamic.spd-mgts.ru. [46.138.80.108]) by smtp.gmail.com with ESMTPSA id m10sm1408899lfr.272.2021.09.26.15.42.39 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 Sep 2021 15:42:39 -0700 (PDT) From: Dmitry Osipenko To: Thierry Reding , Jonathan Hunter , Ulf Hansson , Viresh Kumar , Stephen Boyd , Peter De Schrijver , Mikko Perttunen , Peter Chen , Lee Jones , =?UTF-8?q?Uwe=20Kleine-K=C3=B6nig?= , Nishanth Menon , Adrian Hunter , Michael Turquette Cc: linux-kernel@vger.kernel.org, linux-tegra@vger.kernel.org, linux-pm@vger.kernel.org, linux-usb@vger.kernel.org, linux-staging@lists.linux.dev, linux-pwm@vger.kernel.org, linux-mmc@vger.kernel.org, dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, linux-clk@vger.kernel.org, Mark Brown , Vignesh Raghavendra , Richard Weinberger , Miquel Raynal , Lucas Stach , Stefan Agner , Mauro Carvalho Chehab , David Heidelberg Subject: [PATCH v13 12/35] drm/tegra: hdmi: Add OPP support Date: Mon, 27 Sep 2021 01:40:35 +0300 Message-Id: <20210926224058.1252-13-digetx@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210926224058.1252-1-digetx@gmail.com> References: <20210926224058.1252-1-digetx@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The HDMI on Tegra belongs to the core power domain and we're going to enable GENPD support for the core domain. Now HDMI driver must use OPP API for driving the controller's clock rate because OPP API takes care of reconfiguring the domain's performance state based on HDMI clock rate. Add OPP support to the HDMI driver. Signed-off-by: Dmitry Osipenko --- drivers/gpu/drm/tegra/hdmi.c | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/tegra/hdmi.c b/drivers/gpu/drm/tegra/hdmi.c index e5d2a4026028..9a87d351a828 100644 --- a/drivers/gpu/drm/tegra/hdmi.c +++ b/drivers/gpu/drm/tegra/hdmi.c @@ -11,10 +11,13 @@ #include #include #include +#include #include #include #include +#include + #include #include #include @@ -1195,7 +1198,7 @@ static void tegra_hdmi_encoder_enable(struct drm_encoder *encoder) h_back_porch = mode->htotal - mode->hsync_end; h_front_porch = mode->hsync_start - mode->hdisplay; - err = clk_set_rate(hdmi->clk, hdmi->pixel_clock); + err = dev_pm_opp_set_rate(hdmi->dev, hdmi->pixel_clock); if (err < 0) { dev_err(hdmi->dev, "failed to set HDMI clock frequency: %d\n", err); @@ -1732,7 +1735,14 @@ static int tegra_hdmi_probe(struct platform_device *pdev) } platform_set_drvdata(pdev, hdmi); - pm_runtime_enable(&pdev->dev); + + err = devm_pm_runtime_enable(&pdev->dev); + if (err) + return err; + + err = devm_tegra_core_dev_init_opp_table_common(&pdev->dev); + if (err) + return err; INIT_LIST_HEAD(&hdmi->client.list); hdmi->client.ops = &hdmi_client_ops; @@ -1753,8 +1763,6 @@ static int tegra_hdmi_remove(struct platform_device *pdev) struct tegra_hdmi *hdmi = platform_get_drvdata(pdev); int err; - pm_runtime_disable(&pdev->dev); - err = host1x_client_unregister(&hdmi->client); if (err < 0) { dev_err(&pdev->dev, "failed to unregister host1x client: %d\n", -- 2.32.0