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: 10247439 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 584CA60211 for ; Wed, 28 Feb 2018 12:52:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 4B0C82857E for ; Wed, 28 Feb 2018 12:52:55 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 3FC6928600; Wed, 28 Feb 2018 12:52:55 +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.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id C3C1A2863B for ; Wed, 28 Feb 2018 12:52:53 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EEAF36E001; Wed, 28 Feb 2018 12:52:49 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.micronovasrl.com (mail.micronovasrl.com [212.103.203.10]) by gabe.freedesktop.org (Postfix) with ESMTP id D30396E001 for ; Wed, 28 Feb 2018 12:52:48 +0000 (UTC) Received: from mail.micronovasrl.com (mail.micronovasrl.com [127.0.0.1]) by mail.micronovasrl.com (Postfix) with ESMTP id 0EA50B00A45 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 9l4lqGYG44Is 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-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Direct Rendering Infrastructure - Development 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 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" 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 */