Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp3690555ybv; Mon, 10 Feb 2020 04:46:52 -0800 (PST) X-Google-Smtp-Source: APXvYqyKFm2GZAAYPFfNwXM/tHvUwWBUpA/Fj6o6xGJ3Chgs1I1DaQ7z7znI+rKQQMfPi28H8Srd X-Received: by 2002:aca:ea43:: with SMTP id i64mr736499oih.30.1581338812435; Mon, 10 Feb 2020 04:46:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1581338812; cv=none; d=google.com; s=arc-20160816; b=tzAQmnE5ImZgAIKgfcWGT8RpyRjAsnBTF4uVNt83oKjDX9SkRbYh+DK5lbVggT3qCW q+gwzHsOid+xJMhxrFIRN1eKhBFnd0qiTINk17HMAgEBCWk6fOwLCNlv2q0PsEql+dIE GhWCwjHolwpGkha7kzmuUnqbbpSLUEAJ/Jom3+zZ5W+qwXB5SO/bRt35lamDtIfxk2uY QPFwfA+iJAym2y2XrNYQ6m7ldff4N3Ka2dEgZY7SU5zjfKLyVTazyEanodgKyWIO6jN5 uOU+j2nEkBTMqWP6YOKeEQChhI2solLepXtuv3Nl33CNGg1Q1bjrRILUWemMwGfPMoYH Pzxw== 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=kkB8CtMw15CB1qi4uCahhaNafvOkjQcQgLZpU0BUGV0=; b=zjRnNtYanJgpcVn/mE+2oyoGUQFVz/tR8TNYbHN8BIPhfeCdw/kSM8SrkE94KMUL0N /ELkceZzLUzki7aVlfTnR3knHJWQwwWIHzy7gFKT/QL6UBB67Gks+LzjGOICOIfv2IZY kL/5VRAKfz4+uT0Ai+RHYno04NDmuPYDp0uaY+u+xrBHgNB2rFk961vT2oP4q4iZ3U82 wLmi6rlfldO7hTuXkZ7UQ9WkSh9uzhLJqq8OiMLQ+f98SKmGLEKxgo3Lucpicfo6Kck2 2FMkzsUjTWu07o0mOXLkojJkezp/Ur7zAF7qXOM3ObGWlhuV3uBOI2nGpy4R68NZW9+v 6J+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=Ohs6WUAX; 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 d8si124933oti.306.2020.02.10.04.46.40; Mon, 10 Feb 2020 04:46:52 -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=Ohs6WUAX; 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 S1730156AbgBJMpO (ORCPT + 99 others); Mon, 10 Feb 2020 07:45:14 -0500 Received: from mail.kernel.org ([198.145.29.99]:42044 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728581AbgBJMk7 (ORCPT ); Mon, 10 Feb 2020 07:40:59 -0500 Received: from localhost (unknown [209.37.97.194]) (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 825342173E; Mon, 10 Feb 2020 12:40:58 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1581338458; bh=rVtizd47pPRclKqUkCqje4zkgi1bBzaeodtlgmwOJag=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=Ohs6WUAXqnjCmPP4u1CohStUNKYu6RazGXiTn1SsRpTS21pMnsgxBWWuNPzpzJwCC MIQtEfGdRkFwBto5d8XsmCKNUovSHriK0Y/SgiIu8zXeT5+sOXF3j4Uex72jzS0qob GIVz0E6fAMgq9jBWa02/jmwtU8QvhKSQDFocDcXw= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Claudiu Beznea , Sam Ravnborg , Boris Brezillon Subject: [PATCH 5.5 213/367] drm: atmel-hlcdc: enable clock before configuring timing engine Date: Mon, 10 Feb 2020 04:32:06 -0800 Message-Id: <20200210122443.945930070@linuxfoundation.org> X-Mailer: git-send-email 2.25.0 In-Reply-To: <20200210122423.695146547@linuxfoundation.org> References: <20200210122423.695146547@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 commit 2c1fb9d86f6820abbfaa38a6836157c76ccb4e7b upstream. 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: Greg Kroah-Hartman --- drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_crtc.c @@ -73,7 +73,11 @@ static void atmel_hlcdc_crtc_mode_set_no unsigned long prate; unsigned int mask = ATMEL_HLCDC_CLKDIV_MASK | ATMEL_HLCDC_CLKPOL; unsigned int cfg = 0; - 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; @@ -147,6 +151,8 @@ static void atmel_hlcdc_crtc_mode_set_no ATMEL_HLCDC_VSPSU | ATMEL_HLCDC_VSPHO | ATMEL_HLCDC_GUARDTIME_MASK | ATMEL_HLCDC_MODE_MASK, cfg); + + clk_disable_unprepare(crtc->dc->hlcdc->sys_clk); } static enum drm_mode_status