From patchwork Thu Oct 24 16:45:26 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Thierry Reding X-Patchwork-Id: 11210325 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 9A9DD14ED for ; Thu, 24 Oct 2019 16:47:07 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 829D720659 for ; Thu, 24 Oct 2019 16:47:07 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 829D720659 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=gmail.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3B31F6E532; Thu, 24 Oct 2019 16:46:54 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-wr1-x441.google.com (mail-wr1-x441.google.com [IPv6:2a00:1450:4864:20::441]) by gabe.freedesktop.org (Postfix) with ESMTPS id 585216E503 for ; Thu, 24 Oct 2019 16:46:33 +0000 (UTC) Received: by mail-wr1-x441.google.com with SMTP id v9so15587284wrq.5 for ; Thu, 24 Oct 2019 09:46:33 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=J+teLrDmUq/g4c7wc3+RbjUGyVD2T7B6IPhjV4FrY+o=; b=f5br7k/8uS5k52zu6tRdgMK8wdRxL6CICBQ4UTBZsrVMqfo+qxoojr7MMB2GSo2mV3 uA5Fp2cfrprvK/rlz58qMV3WIKyHc6GRbwO4pdJySjuDRzm9yUcBbOMOVjM3k1nb5YVW O32MR0g9Juuo/3D6D3YBKTvzYl0XccQfaf1xYDW3ISP265We63NjggeVVnqcuwfZh4bo ZVCR46mtYXhXVyIoRPPPGkvK9N+jfex5uXCOTJLRhUyYIg1mMpK3oyBVJSblGhsFzs4F PUaIM8h8+hPWg6DN/eOb8qllZA3pNVuqaDqQP8wdV2Mt27PgfEAFSbX4N1qIoXuEcAXb Lefw== X-Gm-Message-State: APjAAAUSJoLPIKU5p7iL6AkMcDS+iUroZQidYcy1PMG0EVoQjfh/N0Tk jpyEeJm2kUO8aTcc6e4p9zVJsn+T X-Google-Smtp-Source: APXvYqxILzNyOiSXsbSp1f4vtgYmepdyNF/ujbe8i31SrmYnTTz3zGzE96FmDDaPMXk7zs4FolzQig== X-Received: by 2002:a5d:638f:: with SMTP id p15mr4963666wru.150.1571935591737; Thu, 24 Oct 2019 09:46:31 -0700 (PDT) Received: from localhost (p2E5BE2CE.dip0.t-ipconnect.de. [46.91.226.206]) by smtp.gmail.com with ESMTPSA id r1sm19783003wrw.60.2019.10.24.09.46.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 24 Oct 2019 09:46:30 -0700 (PDT) From: Thierry Reding To: Thierry Reding Subject: [PATCH 24/32] drm/tegra: sor: Implement pad clock for all SOR instances Date: Thu, 24 Oct 2019 18:45:26 +0200 Message-Id: <20191024164534.132764-25-thierry.reding@gmail.com> X-Mailer: git-send-email 2.23.0 In-Reply-To: <20191024164534.132764-1-thierry.reding@gmail.com> References: <20191024164534.132764-1-thierry.reding@gmail.com> MIME-Version: 1.0 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=J+teLrDmUq/g4c7wc3+RbjUGyVD2T7B6IPhjV4FrY+o=; b=NyyAEeonT461+ilpnoe9F3HqNKX94i5GlETWA3k3XcYZKsdNMiUKnSvbP/5deI4iKW ubNd2lZ9FTtDB+me9TNBpM9TiJy4UfNEHxQewT6OlHkvyePtViLsc7DzByadrucAw0kd Hr5fU9cLv0L+o2Pf3mdcnZum/u5tDcmKuVXFmz2+vnidYUhcqdX/IYTTDUiAGSRCEiNT JSHwpRAjc9vl4ppV7Ak0KuUZliyhLF+mgv+X6SsOm2SCkCy43viXwwHozx+G4OLDeRt6 72J7ASNqun16rvb7fu1aHSMD2p38wPvNMPizTqreKikFzsKh46DxFGP+WYzn7jt63gNp IHYg== X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-tegra@vger.kernel.org, dri-devel@lists.freedesktop.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" From: Thierry Reding So far the pad clock was only needed on the second SOR instance. The clock does exist for all SOR instances, though, so make sure it is always implemented. This prepares for further unification of the code in subsequent patches. Signed-off-by: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 20 ++++++++++++++------ 1 file changed, 14 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index c7faf088cabc..71a7ed57cb4f 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -522,8 +522,9 @@ static inline struct tegra_clk_sor_pad *to_pad(struct clk_hw *hw) return container_of(hw, struct tegra_clk_sor_pad, hw); } -static const char * const tegra_clk_sor_pad_parents[] = { - "pll_d2_out0", "pll_dp" +static const char * const tegra_clk_sor_pad_parents[2][2] = { + { "pll_d_out0", "pll_dp" }, + { "pll_d2_out0", "pll_dp" }, }; static int tegra_clk_sor_pad_set_parent(struct clk_hw *hw, u8 index) @@ -594,8 +595,8 @@ static struct clk *tegra_clk_sor_pad_register(struct tegra_sor *sor, init.name = name; init.flags = 0; - init.parent_names = tegra_clk_sor_pad_parents; - init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents); + init.parent_names = tegra_clk_sor_pad_parents[sor->index]; + init.num_parents = ARRAY_SIZE(tegra_clk_sor_pad_parents[sor->index]); init.ops = &tegra_clk_sor_pad_ops; pad->hw.init = &init; @@ -4016,6 +4017,8 @@ static int tegra_sor_probe(struct platform_device *pdev) * pad output clock. */ if (!sor->clk_pad) { + char *name; + err = pm_runtime_get_sync(&pdev->dev); if (err < 0) { dev_err(&pdev->dev, "failed to get runtime PM: %d\n", @@ -4023,8 +4026,13 @@ static int tegra_sor_probe(struct platform_device *pdev) goto remove; } - sor->clk_pad = tegra_clk_sor_pad_register(sor, - "sor1_pad_clkout"); + name = devm_kasprintf(&pdev->dev, GFP_KERNEL, "sor%u_pad_clkout", sor->index); + if (!name) { + err = -ENOMEM; + goto remove; + } + + sor->clk_pad = tegra_clk_sor_pad_register(sor, name); pm_runtime_put(&pdev->dev); }