From patchwork Mon Sep 20 18:11:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Osipenko X-Patchwork-Id: 12506961 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id E8297C433FE for ; Tue, 21 Sep 2021 02:42:29 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 9D56B60ED5 for ; Tue, 21 Sep 2021 02:42:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1351086AbhIUCnz (ORCPT ); Mon, 20 Sep 2021 22:43:55 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:35698 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241778AbhIUCC4 (ORCPT ); Mon, 20 Sep 2021 22:02:56 -0400 Received: from mail-lf1-x131.google.com (mail-lf1-x131.google.com [IPv6:2a00:1450:4864:20::131]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 3668DC1400BF; Mon, 20 Sep 2021 11:12:18 -0700 (PDT) Received: by mail-lf1-x131.google.com with SMTP id y28so69654026lfb.0; Mon, 20 Sep 2021 11:12:18 -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=gF0izKWgPDK1Pxgz7IYMUtVSKO9M3XmdO4pBUFDdfqar6zowa+E+8zJgi301uYxwV8 VMJukuYXojTrPKRgrAWVB2eKAQGOK+/7GbCiPLZRHW0T3D4C26Gko8Q9BJHUeaeTO7ZC PbskivyGxj9pvj9DRXSB337+q2daIGxhHUAq0Pv4kctHXEucO2pKxNjPF3e6kJn24Lo3 yz74nocH8T2mkcX2eNfBoZnt+ZZ2m/bsvo69Xij6T1wxT8DXQgIm+LFjNTmXNYMF6DdZ 9MCFc7GVzBD77y158WyfT+YRwKuOHYS3mLGSicS83eGM0WlkHaPS+cZfR5T7bm9WnOVZ /VcQ== 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=fI76b8rWLVLLRTU847Oe4yqVw7CZqiMJ2O5hzpIlV92+wu6Q0z6nAkev+BHidxi9fk I4ILuZyYK45Cg1NEqhP9Vl+NTMSP4XEF2OoaG6gZSUVTo816LNA7JGenEsVblh16A/6X 8v7sizFnT+izXG+HfWQOi5lWFkmcJ3tipKSIDzcBJMEn1XKYh/JWmegfjeE/6QYGiMdv 5mBKa80O44pyaRo62+hImy+SEYY976fooAcnIxcocx26I1k4wiLJ7QDsqxZfHB75OLVo wpPftGmXdc5TEyWYhm2CHXqUx8tfShsWCefcEBFo/w/b+HJ1Of+dJk4UMXCYAZaUoRH+ C3kQ== X-Gm-Message-State: AOAM530b7GVXJj0/Cwu7MhVFG4j5pdcO9v04Yypj/WHEd+jkJwU2CXH+ f1jvfZvMNPxDKBQqNx/wEDU= X-Google-Smtp-Source: ABdhPJxPXYpI5PIbFg9WnjrInh+nWnzACLXFjxgnPsN6EAHiFlKm2h/XSbPlavZg35ieNhXxVWARzw== X-Received: by 2002:a05:651c:2120:: with SMTP id a32mr23220046ljq.252.1632161533775; Mon, 20 Sep 2021 11:12:13 -0700 (PDT) Received: from localhost.localdomain (46-138-151-206.dynamic.spd-mgts.ru. [46.138.151.206]) by smtp.gmail.com with ESMTPSA id u3sm1775677lju.107.2021.09.20.11.12.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 20 Sep 2021 11:12:13 -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_Kleine-K=C3=B6nig?= , Nishanth Menon , Adrian Hunter , Rob Herring , 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 v12 12/35] drm/tegra: hdmi: Add OPP support Date: Mon, 20 Sep 2021 21:11:22 +0300 Message-Id: <20210920181145.19543-13-digetx@gmail.com> X-Mailer: git-send-email 2.32.0 In-Reply-To: <20210920181145.19543-1-digetx@gmail.com> References: <20210920181145.19543-1-digetx@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-pm@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",