From patchwork Mon Dec 4 18:37:59 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Guillaume Tucker X-Patchwork-Id: 10091257 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id F09916035E for ; Mon, 4 Dec 2017 18:39:24 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E3DA028D5F for ; Mon, 4 Dec 2017 18:39:24 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id D87DA28D66; Mon, 4 Dec 2017 18:39:24 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.2 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [65.50.211.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6CF9F28D5F for ; Mon, 4 Dec 2017 18:39:24 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=qq4ppHNY3DlHSFPIIt89sYM8B9q3vPWN0VT7H/K0NGw=; b=VoWBMkSZOWEreZhJxKfMLFXN3c o4mBC+NLTzj6Au5GAvqU8jUVpg0D0Mm1LjwKm7uP7VV5YGze0nwIjwZxgzrUlhV17Hc5TdBn1ifa6 MmiTSrK8fajA2CiQr6s3IP4KLlDq2CE8pUnu8NpoH2j74b2uNFqgGgW0/U2MfJxeBMdWIHUbM77KW //DOXBbXhu7+O4qDqSUQe+OPzwo/OjdGLW3ycYsW9A/6JcUJdxadB/gv/AEBIxn6dGhiLjr71g8t0 N8dnD6+JFsv2URFF834vMrFXau8GsmF0sSyID2VN5Or7MyAjxb0ccKRdqr3hTyDxwPBsgZi2hsdJj puMs7PBA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.87 #1 (Red Hat Linux)) id 1eLve9-0002nf-5B; Mon, 04 Dec 2017 18:39:17 +0000 Received: from bhuna.collabora.co.uk ([2a00:1098:0:82:1000:25:2eeb:e3e3]) by bombadil.infradead.org with esmtps (Exim 4.87 #1 (Red Hat Linux)) id 1eLvdv-0001pD-LJ for linux-arm-kernel@lists.infradead.org; Mon, 04 Dec 2017 18:39:06 +0000 Received: from submarine.cbg.collabora.co.uk (unknown [IPv6:2a00:5f00:102:0:d0a5:4565:9830:3aaf]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) (Authenticated sender: gtucker) by bhuna.collabora.co.uk (Postfix) with ESMTPSA id 42A442702E1; Mon, 4 Dec 2017 18:38:42 +0000 (GMT) From: Guillaume Tucker To: Jonathan Hunter , David Airlie 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: X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20171204_103903_934532_23E85F61 X-CRM114-Status: GOOD ( 13.35 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Guillaume Tucker , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, linux-tegra@vger.kernel.org, Thierry Reding , linux-arm-kernel@lists.infradead.org MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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);