Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752732AbdLDSiu (ORCPT ); Mon, 4 Dec 2017 13:38:50 -0500 Received: from bhuna.collabora.co.uk ([46.235.227.227]:52810 "EHLO bhuna.collabora.co.uk" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752691AbdLDSin (ORCPT ); Mon, 4 Dec 2017 13:38:43 -0500 From: Guillaume Tucker To: Jonathan Hunter , David Airlie Cc: dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Guillaume Tucker , Thierry Reding Subject: [PATCH 2/2] drm/tegra: sor: Fix hang on tegra124 due to NULL clk_out Date: Mon, 4 Dec 2017 18:37:59 +0000 Message-Id: <79b4a60f1d624b16eaef06258318861d4407fecd.1512411775.git.guillaume.tucker@collabora.com> X-Mailer: git-send-email 2.11.0 In-Reply-To: References: In-Reply-To: References: Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1981 Lines: 58 When neither HDMI nor DP is supported such as on the tegra124, the sor->clk_out is not initialised and remains NULL. In this case, the parent clock can't be assigned to it so revert to the previous behaviour of assigning it to the main sor->clock instead. This fixes a kernel hang on tegra124. Fixes: e1335e2f0cfc ("drm/tegra: sor: Reimplement pad clock") Signed-off-by: Guillaume Tucker CC: Thierry Reding --- drivers/gpu/drm/tegra/sor.c | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/tegra/sor.c b/drivers/gpu/drm/tegra/sor.c index b0a1dedac802..8d2e29c9ab2b 100644 --- a/drivers/gpu/drm/tegra/sor.c +++ b/drivers/gpu/drm/tegra/sor.c @@ -255,7 +255,7 @@ static int tegra_sor_set_parent_clock(struct tegra_sor *sor, struct clk *parent) clk_disable_unprepare(sor->clk); - err = clk_set_parent(sor->clk_out, parent); + err = clk_set_parent(sor->clk_out ? sor->clk_out : sor->clk, parent); if (err < 0) return err; @@ -2698,15 +2698,19 @@ static int tegra_sor_probe(struct platform_device *pdev) sor->clk_pad = NULL; } - /* - * The bootloader may have set up the SOR such that it's module clock - * is sourced by one of the display PLLs. However, that doesn't work - * without properly having set up other bits of the SOR. - */ - err = clk_set_parent(sor->clk_out, sor->clk_safe); - if (err < 0) { - dev_err(&pdev->dev, "failed to use safe clock: %d\n", err); - goto remove; + if (sor->clk_out) { + /* + * The bootloader may have set up the SOR such that its module + * clock is sourced by one of the display PLLs. However, that + * doesn't work without properly having set up other bits of + * the SOR. + */ + err = clk_set_parent(sor->clk_out, sor->clk_safe); + if (err < 0) { + dev_err(&pdev->dev, "failed to use safe clock: %d\n", + err); + goto remove; + } } platform_set_drvdata(pdev, sor); -- 2.11.0