From patchwork Wed Feb 28 12:51:58 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Giulio Benetti X-Patchwork-Id: 10247441 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 302E560211 for ; Wed, 28 Feb 2018 12:53:19 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 23880286D6 for ; Wed, 28 Feb 2018 12:53:19 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 17D9D28D1A; Wed, 28 Feb 2018 12:53:19 +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=-1.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID autolearn=unavailable version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.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 A2F68286D6 for ; Wed, 28 Feb 2018 12:53:18 +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: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:In-Reply-To: References:List-Owner; bh=iwZHGlilKFpPGPhs6yi0EOcfYYo3SF9xerl2tkbqJNA=; b=Def 6jq0MAru47JdtaT/VQAV+wngf6Ae+ESIFAbMA021I4ikm9FYLNzQsNvWMGsoMSHMXhHXKWIzM+PCE WDscEN57yYgUrrE+9TbVsYZwhjTQ09W6ZOAbMIpPVTUK2u1JHD5KC0yAdGyNE+pHds/I/7FRRkXwB VInfWckBM97DREFXCCznnJRPq3XzsRhZyiQVF6hDqZOpzXDAHu5F4PjmHxS/8l+4sjGthYJhqk/Kq OoXLcz3wRTlhfVOwCI4+UXBgGmgjbmlaahHNqcnXG8RPEWjhyrYPnZ+uRCh/bKSVeBfNz21YijHpm rpUiHx9BAey9DeiZcsB0lrOQlmjTUpQ==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1er1EL-0007gA-AX; Wed, 28 Feb 2018 12:53:09 +0000 Received: from mail.micronovasrl.com ([212.103.203.10]) by bombadil.infradead.org with esmtp (Exim 4.89 #1 (Red Hat Linux)) id 1er1EF-0007e3-Pq for linux-arm-kernel@lists.infradead.org; Wed, 28 Feb 2018 12:53:05 +0000 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 1F13CB00A43 for ; Wed, 28 Feb 2018 13:52:47 +0100 (CET) Authentication-Results: mail.micronovasrl.com (amavisd-new); dkim=pass reason="pass (just generated, assumed good)" header.d=micronovasrl.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=micronovasrl.com; h=x-mailer:message-id:date:date:subject:subject:to:from:from; s=dkim; t=1519822366; x=1520686367; bh=LPapDgDcqWPcAMGnuItGCdL9 OPIVdQFQtOCAg/rO72Y=; b=PtFxG9bU19L5Fx3eVaQeS4MSAMUtAXhQ6tOhtDo/ ORNsV6HGfNqjNZU8B5d8MfkOemUr9V8HhZwEtPgyt9AS2bxxNJlRrbWMtUCJoXGV 2gUU6ksRBe7r/up+wWiv78PZv7lRRWxM1kIetseeU5y2+LCdbvbBQYBrEG7lCRRU YGU= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com Received: from mail.micronovasrl.com ([127.0.0.1]) by mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id iwqCCzbVT54v for ; Wed, 28 Feb 2018 13:52:46 +0100 (CET) Received: from localhost.localdomain (62-11-51-166.dialup.tiscali.it [62.11.51.166]) by mail.micronovasrl.com (Postfix) with ESMTPSA id BA219B003B2; Wed, 28 Feb 2018 13:52:45 +0100 (CET) From: Giulio Benetti To: Maxime Ripard Subject: [PATCH] drm/sun4i: init dclk_min_div & dclk_max_div inside encoder init functions Date: Wed, 28 Feb 2018 13:51:58 +0100 Message-Id: <1519822318-3974-1-git-send-email-giulio.benetti@micronovasrl.com> X-Mailer: git-send-email 2.7.4 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180228_045304_039239_8EE7D521 X-CRM114-Status: UNSURE ( 9.79 ) X-CRM114-Notice: Please train this message. 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: David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chen-Yu Tsai , Giulio Benetti , 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 sun4i_dclk_round_rate is called before sun4i_tcon_mode_set, so it finds dclk_min_div and dclk_max_div set to 0 and fails adding crtc. Move dclk_min_div and dclk_max_div to encoders init functions. Signed-off-by: Giulio Benetti --- drivers/gpu/drm/sun4i/sun4i_lvds.c | 4 ++++ drivers/gpu/drm/sun4i/sun4i_rgb.c | 4 ++++ drivers/gpu/drm/sun4i/sun4i_tcon.c | 4 ---- 3 files changed, 8 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun4i_lvds.c b/drivers/gpu/drm/sun4i/sun4i_lvds.c index be3f14d..6e1abd6 100644 --- a/drivers/gpu/drm/sun4i/sun4i_lvds.c +++ b/drivers/gpu/drm/sun4i/sun4i_lvds.c @@ -123,6 +123,10 @@ int sun4i_lvds_init(struct drm_device *drm, struct sun4i_tcon *tcon) return 0; } + /* Init min and max clock divisor according to LVDS encoder */ + tcon->dclk_min_div = 7; + tcon->dclk_max_div = 7; + drm_encoder_helper_add(&lvds->encoder, &sun4i_lvds_enc_helper_funcs); ret = drm_encoder_init(drm, diff --git a/drivers/gpu/drm/sun4i/sun4i_rgb.c b/drivers/gpu/drm/sun4i/sun4i_rgb.c index 832f8f9..75ab3e5 100644 --- a/drivers/gpu/drm/sun4i/sun4i_rgb.c +++ b/drivers/gpu/drm/sun4i/sun4i_rgb.c @@ -187,6 +187,10 @@ int sun4i_rgb_init(struct drm_device *drm, struct sun4i_tcon *tcon) return 0; } + /* Init min and max clock divisor according to RGB encoder */ + tcon->dclk_min_div = 6; + tcon->dclk_max_div = 127; + drm_encoder_helper_add(&rgb->encoder, &sun4i_rgb_enc_helper_funcs); ret = drm_encoder_init(drm, diff --git a/drivers/gpu/drm/sun4i/sun4i_tcon.c b/drivers/gpu/drm/sun4i/sun4i_tcon.c index e7c5e3c..ce89fd4 100644 --- a/drivers/gpu/drm/sun4i/sun4i_tcon.c +++ b/drivers/gpu/drm/sun4i/sun4i_tcon.c @@ -277,8 +277,6 @@ static void sun4i_tcon0_mode_set_lvds(struct sun4i_tcon *tcon, u8 clk_delay; u32 reg, val = 0; - tcon->dclk_min_div = 7; - tcon->dclk_max_div = 7; sun4i_tcon0_mode_set_common(tcon, mode); /* Adjust clock delay */ @@ -348,8 +346,6 @@ static void sun4i_tcon0_mode_set_rgb(struct sun4i_tcon *tcon, u8 clk_delay; u32 val = 0; - tcon->dclk_min_div = 6; - tcon->dclk_max_div = 127; sun4i_tcon0_mode_set_common(tcon, mode); /* Adjust clock delay */