From patchwork Thu Dec 7 15:58:51 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 121006 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp8534106qgn; Thu, 7 Dec 2017 08:00:08 -0800 (PST) X-Google-Smtp-Source: AGs4zMZ0kEXYfzpYXiBfj7GUR6Em8+6y6neiU5BfmqyAqNZK9BKjR2pzzu9DqzX3OwzeTQqkj95w X-Received: by 10.99.123.90 with SMTP id k26mr25944902pgn.33.1512662408676; Thu, 07 Dec 2017 08:00:08 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512662408; cv=none; d=google.com; s=arc-20160816; b=HTD5IHQ6YDQ9QJNGe84y5FPOi5+HI1I5koStgE6/ACYyv6AOkUA4Kf8/c4OQrc1sW9 6440T2z1tAPt2bBJTaUNVU0IByn+XNNXPZJELkyq2pmDiFXjeSVaqk1xV4+nTVnslqw8 Ivj811rD678YC4GmNmwNBW/O2ELoTlZTWINjDC31u+QF2s6N0VVcRTGAGbyCltniPsud xbLJhkVGcynew/WRMNQTcdwyplZ33Se7O5vrNGM8ZfXQ3y9wyoWvhKE20TuJeEOdB+eF oaMDomw5mFeoc/xUNSaMJ56HaFiKD3vaDNbuhhnkhjSf1zO+KcmyMKRhCcWnddtYwS/4 aoMA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:content-transfer-encoding:mime-version :list-subscribe:list-help:list-post:list-archive:list-unsubscribe :list-id:precedence:cc:references:in-reply-to:references:in-reply-to :message-id:date:subject:to:from:delivered-to :arc-authentication-results; bh=3qBa8P91rmWb3Vl9Fin/TfJEyF9WRHex731YQQ+f/uI=; b=1Jfoi14E9TVMXxcMcTqJZ+odTndcLiKTNEIfUk9WXkOdZFgRj0d9v4dpM0z49V3h63 nDGSGUZ6/x0Rx4GgBfZhXTiH8xsIv0HJ7El7O5yEYgYcYQ5tu9o1qh6+1DDt5UuXTz5h VUz5zxgT8roEYSQBmZiaRfOUbGWwHvRRM/zkDdrtsVg1L503BVDHW18kgBFfj7B8zUUV C2ExPRm0IRFh+AZJuQy6Av3hBIiG6tHjte0B2tBYDAlEDH8Jee268irN0nHHt95EP+ue MiwLiCcIJnJROJgphlp0JbAGgyQKaJ++cfP04VMMucFhaTjwCegrKI7/Tsmb+tFaGmau p8DA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id r27si3856548pgn.85.2017.12.07.08.00.08 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 07 Dec 2017 08:00:08 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 54C866E814; Thu, 7 Dec 2017 15:59:33 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.free-electrons.com (mail.free-electrons.com [62.4.15.54]) by gabe.freedesktop.org (Postfix) with ESMTP id D2B3A6E847 for ; Thu, 7 Dec 2017 15:59:29 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id 9C5D420D84; Thu, 7 Dec 2017 16:59:28 +0100 (CET) X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on mail.free-electrons.com X-Spam-Level: X-Spam-Status: No, score=-1.0 required=5.0 tests=ALL_TRUSTED,SHORTCIRCUIT shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (unknown [185.94.189.187]) by mail.free-electrons.com (Postfix) with ESMTPSA id 9B2A420D96; Thu, 7 Dec 2017 16:59:17 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v4 06/15] drm/sun4i: Force the mixer rate at 150MHz Date: Thu, 7 Dec 2017 16:58:51 +0100 Message-Id: <34f2c9d5c9ab48ead94253144a8e829cccfa4653.1512662253.git-series.maxime.ripard@free-electrons.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: References: In-Reply-To: References: Cc: Mark Rutland , Thomas Petazzoni , jernej.skrabec@siol.net, plaes@plaes.org, devicetree@vger.kernel.org, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Rob Herring , thierry.reding@gmail.com, linux-arm-kernel@lists.infradead.org, icenowy@aosc.io X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" It seems like the mixer can only run properly when clocked at 150MHz. In order to have something more robust than simply a fire-and-forget assigned-clocks-rate, let's put that in the code. Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun8i_mixer.c | 9 +++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 3 +++ 2 files changed, 12 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 29ceeb016d72..ff235e3228ce 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -400,6 +400,14 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, } clk_prepare_enable(mixer->mod_clk); + /* + * It seems that we need to enforce that rate for whatever + * reason for the mixer to be functional. Make sure it's the + * case. + */ + if (mixer->cfg->mod_rate) + clk_set_rate(mixer->mod_clk, mixer->cfg->mod_rate); + list_add_tail(&mixer->engine.list, &drv->engine_list); /* Reset the registers */ @@ -474,6 +482,7 @@ static const struct sun8i_mixer_cfg sun8i_v3s_mixer_cfg = { .ui_num = 1, .scaler_mask = 0x3, .ccsc = 0, + .mod_rate = 150000000, }; static const struct of_device_id sun8i_mixer_of_table[] = { diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.h b/drivers/gpu/drm/sun4i/sun8i_mixer.h index bc58040a88f9..f34e70c42adf 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.h +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.h @@ -121,12 +121,15 @@ struct de2_fmt_info { * Set value to 0 if this is first mixer or second mixer with VEP support. * Set value to 1 if this is second mixer without VEP support. Other values * are invalid. + * @mod_rate: module clock rate that needs to be set in order to have + * a functional block. */ struct sun8i_mixer_cfg { int vi_num; int ui_num; int scaler_mask; int ccsc; + unsigned long mod_rate; }; struct sun8i_mixer {