Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp666241ybv; Thu, 13 Feb 2020 07:26:35 -0800 (PST) X-Google-Smtp-Source: APXvYqwrOursmo09daalR3u7mzQ85ak/lEJv8phnHkDJPASSjW2X8fb6wpTcBHRLWZqxNvL0f1BR X-Received: by 2002:a9d:32f:: with SMTP id 44mr13335392otv.234.1581607594960; Thu, 13 Feb 2020 07:26:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581607594; cv=none; d=google.com; s=arc-20160816; b=Nk+9Lpmyp2qM3Arbf//LZsMpB6wtwdsbnLs+WGqE6704JQ4BKrEsEwWu73lKgfpU6X K2HqYheaeoq+YajRPEwAZBHI4ioQkzGYrdEv5F+AOOYWRJxHfeL5SAcgwaTnh+nopONC PXmjLSfKxSsqzoUFWYj+5iawtOxbXZGGSFw+gUOWOdcnElQXIOcRzcBJvF8td3lawPJl ozm6lubLsupgdcF5dMcNAyEAWs/6fBqDZ21S99LXbECswyFd9GYjDxERTqexYIyERkPo IKHEBC8GCRgEkpolucmcX6rb7HM0FsXj89HT/rSNvSVqxpT1gQRUIIGr585Qh9fxYmtJ MTYw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=I+n2eUm6qiEakpPY9FcJA1fu1zqd2pIit115Fxqest8=; b=rN2+wGGug7MhfO2JaKonmpODx2404ZHuBqm7nz559i2afFm5mefGG28AK2Yp6xoYYw 1GjolYhv6dgcQTn3zHHCFNECjoejZ6tQ4+RmjjAotPOxTuUhS1HbPkgE3g+pc6zR2jjO wpAQ5fnYfvJRoNePd7sUGqz2M9YYHvBfVxTcwb9VHxeLrhUhyAVRGY+9a3G2aFu9KmOK VtEAFXKd9pijU7zd/TpPzVXqXf+EkFP1YfoGLNwuObQATLgc7+FlCajJgQSY7pmq3uFL ZQlhU8TLADgMdJ1Ixwo6U5ZaWihna7VPdaZ/2C5M00qgM55OF2ECJNH1kzTnUKL3uFXn 6ULw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pa913HQW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 7si1157035oiy.68.2020.02.13.07.26.22; Thu, 13 Feb 2020 07:26:34 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Pa913HQW; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728197AbgBMPZn (ORCPT + 99 others); Thu, 13 Feb 2020 10:25:43 -0500 Received: from mail.kernel.org ([198.145.29.99]:36710 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728033AbgBMPYF (ORCPT ); Thu, 13 Feb 2020 10:24:05 -0500 Received: from localhost (unknown [104.132.1.104]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id 16CF924699; Thu, 13 Feb 2020 15:24:05 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581607445; bh=ci0cWJhWEJ5TIxrNLKSvUC5wi9hhvqvQis8zL+6Emvw=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Pa913HQWii9TKET2rOwFWJ49y4IgCnD8ynhpvjepFteo+dOVqsCFW4W9HDuEvUQrw c7vTnibAYS0AqBN7Qhxule8CyR537xWhcbBOJzaJGTOPsJGwyDkju4MwRBsIxCa4Qk 8fMpYJlAUsM3CfYlKgZKPxNu+Sbri9JyRM7K3ogE= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Sam Ravnborg , Boris Brezillon , Sasha Levin Subject: [PATCH 4.9 086/116] drm: atmel-hlcdc: enable clock before configuring timing engine Date: Thu, 13 Feb 2020 07:20:30 -0800 Message-Id: <20200213151916.139732436@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200213151842.259660170@linuxfoundation.org> References: <20200213151842.259660170@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Claudiu Beznea [ Upstream commit 2c1fb9d86f6820abbfaa38a6836157c76ccb4e7b ] Changing pixel clock source without having this clock source enabled will block the timing engine and the next operations after (in this case setting ATMEL_HLCDC_CFG(5) settings in atmel_hlcdc_crtc_mode_set_nofb() will fail). It is recomended (although in datasheet this is not present) to actually enabled pixel clock source before doing any changes on timing enginge (only SAM9X60 datasheet specifies that the peripheral clock and pixel clock must be enabled before using LCD controller). Fixes: 1a396789f65a ("drm: add Atmel HLCDC Display Controller support") Signed-off-by: Claudiu Beznea Signed-off-by: Sam Ravnborg Cc: Boris Brezillon Cc: # v4.0+ Link: https://patchwork.freedesktop.org/patch/msgid/1576672109-22707-3-git-send-email-claudiu.beznea@microchip.com Signed-off-by: Sasha Levin --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c index 9b17a66cf0e16..aa54a6a2ad1da 100644 --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -81,7 +81,11 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) struct videomode vm; unsigned long prate; unsigned int cfg; - int div; + int div, ret; + + ret = clk_prepare_enable(crtc->dc->hlcdc->sys_clk); + if (ret) + return; vm.vfront_porch = adj->crtc_vsync_start - adj->crtc_vdisplay; vm.vback_porch = adj->crtc_vtotal - adj->crtc_vsync_end; @@ -140,6 +144,8 @@ static void atmel_hlcdc_crtc_mode_set_nofb(struct drm_crtc *c) ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO | ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK, cfg); + + clk_disable_unprepare(crtc->dc->hlcdc->sys_clk); } static bool atmel_hlcdc_crtc_mode_fixup(struct drm_crtc *c, -- 2.20.1