Received: by 10.223.185.116 with SMTP id b49csp6144908wrg; Wed, 28 Feb 2018 04:53:51 -0800 (PST) X-Google-Smtp-Source: AH8x225P9rrw0bg62Z7R31FRqk1SsxKHH1VyHcO177jF79pFU6Ck0N3A7W8RE0pmc1mxNA1nbLhh X-Received: by 2002:a17:902:6ac2:: with SMTP id i2-v6mr17609585plt.368.1519822431750; Wed, 28 Feb 2018 04:53:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1519822431; cv=none; d=google.com; s=arc-20160816; b=wjf6OB0NJlSUvSB4eayGQyW4Ou+Wm310MBCrtY7wXs7nVbmZqpYy27wpJV/J3aj+hj 3S1ynrhZ0VQ6MP9rgzw2BsRTcgDwfhZ0orpvgUva3ZQHf4ILU5UzUuy1dBF6Q0lg9Tlo /qxy4Sw22jJAdzv1mk09DvqRdTyfx2hsHfsc3dgpMg1qdc2IYywVEUFjufznJJBch255 iIb3wFR42yBcvqqBX5z0xca+ZqpL8bNArb7jPOlat+H7CQ4LBuo6LVNSmvoG2QWsy37g f0zeT7pGmtLcWOjGOp7IpICD+AkbzD8bps9VSdpwXOdmVRrBSqgMTh9tj7U/4MFcoSgH 4HZg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=M+vKNDOQRO5trwgUargtN4+XeDS8aGvPYhFTLJCEhPY=; b=Jc4yHkD3Qj8/5JBR6Izbqyx8rRPuOyVCjkjAH53D8hOFLddhkLMvsxi7xBCIB1TdP+ lpN4lnisBTIL7B1iuXQ6A0Fj75lMREkhpAVdWGBkZjkxwx4ScIinHbEAUjdoVRvNSCDP 2VUj9yU3HGREFttnq8RxEeMo6dnm1E3GavtQUfQCbb3uPbbTgP1rbEc4SvaUxLMJiab2 GOqX3QcJI6UnAFHbTmD48i0C4KRY4onLuokaQX9GW5sY5gdkr9iJmYuW7nNUuHResvAM wlGkqiI4mLgU0tOzLL7v9199MQ+oZJN9KOTvepYRhoabuQq9nVtBhD00AirC35k7nS/a 9fTA== ARC-Authentication-Results: i=1; mx.google.com; dkim=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=aFAtbafA; 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 m16si1000887pgn.290.2018.02.28.04.53.34; Wed, 28 Feb 2018 04:53:51 -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=temperror (no key for signature) header.i=@micronovasrl.com header.s=dkim header.b=aFAtbafA; 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 S1752465AbeB1Mwu (ORCPT + 99 others); Wed, 28 Feb 2018 07:52:50 -0500 Received: from mail.micronovasrl.com ([212.103.203.10]:55216 "EHLO mail.micronovasrl.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752206AbeB1Mws (ORCPT ); Wed, 28 Feb 2018 07:52:48 -0500 Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 9678CB00A92 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=1519822367; x=1520686368; bh=LPapDgDcqWPcAMGnuItGCdL9 OPIVdQFQtOCAg/rO72Y=; b=aFAtbafA5n/2SwVo701+8uTea5nfT4gniE1pgenQ RyBrGFaEqHVvMCcAhIqdw4fWU/64axWwtJq/IvGVLrcu6jX9Xx81VoED2z/Zp/gx 48jSTEr1Z9yv0IMpLVTGy5oN2/hCKwpfTPfL/1V8JmyIKygaADfz78UUGwQJHSjO 8ic= X-Virus-Scanned: Debian amavisd-new at mail.micronovasrl.com X-Spam-Flag: NO X-Spam-Score: -2.9 X-Spam-Level: X-Spam-Status: No, score=-2.9 tagged_above=-10 required=4.5 tests=[ALL_TRUSTED=-1, BAYES_00=-1.9] autolearn=unavailable autolearn_force=no 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 p66Xzv_lIjZJ for ; Wed, 28 Feb 2018 13:52:47 +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 Cc: David Airlie , Chen-Yu Tsai , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, Giulio Benetti 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 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 */ -- 2.7.4