From patchwork Tue Dec 5 15:10:18 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 120683 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp5865482qgn; Tue, 5 Dec 2017 07:11:43 -0800 (PST) X-Google-Smtp-Source: AGs4zMYhqktDFqiCuNRoYN9vpi4BkdCxTKlzABO/0xq6Tv70t6WQRSkLkFnVbUTB6NOXQQ3jctQT X-Received: by 10.84.210.137 with SMTP id a9mr18822581pli.17.1512486703479; Tue, 05 Dec 2017 07:11:43 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1512486703; cv=none; d=google.com; s=arc-20160816; b=HRHMcLVo1BUGrak4YGnGD2SK8hU0WfzVDIEEBkgAuikxo4boGU+tuMPPzncAXWkjyE 4VfLQxMFmCuDkNZAuQ0UmqTuk7R71+N/3h6pGvdFwpD1cBAomyfqV2jqGPMDfxlkFJcN vuUn6LdshbshZX4obgB/vnAYI7mcb5hrigclooZnjflMYP6h3kRIGDdGoi86sNmTKK48 VIwrMzKHywS+rt52PnVSNBVwsgvPuj2R+wrrNBzrC7Glw66+RVJzakyl9q1yMgy7Hae3 NS8/lvt9yF+AU37BZdaoyPoeooavri/PYsuRPCXtjYQzv06FsBr2adSbXn9/rMMhkLw/ MsDA== 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=txuQ0QRqhQopVlaKhHOP/5Rg+JlM6U2rZDdpnQOglJnublCwGMZqytZsPEDZ2eY8W9 4/GEHKPD9uZt+5YrprPjcxF/VDYKsISY4lAq0Sx7mWCF6Dc/z9LjGQpmemiLASJwJsZC CFlakmga6iyp9gFrTMMj1VaOzHsXPNtiflrdwe1GeD2XY3ggaB2CTHwXR5Bp665jrZmf Ubv3fhze8pTMn9L8fWT0gkcqe5u2FPay/9ScMyxMo9cK0b+zShTERvJQLn7PlZUbBYpy 5P9FJSAIRYhmHS9Gw4fziGcRQVis/9AxbH1rYYv6eYjaU5fwX9fbxB72foERz4AUsi0C hx1g== 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 bf3si209199plb.105.2017.12.05.07.11.43 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Tue, 05 Dec 2017 07:11:43 -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 9FCDC6E596; Tue, 5 Dec 2017 15:10:45 +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 EA4536E58C for ; Tue, 5 Dec 2017 15:10:40 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id B4B1820976; Tue, 5 Dec 2017 16:10:39 +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, URIBL_BLOCKED shortcircuit=ham autolearn=disabled version=3.4.0 Received: from localhost (LStLambert-657-1-97-87.w90-63.abo.wanadoo.fr [90.63.216.87]) by mail.free-electrons.com (Postfix) with ESMTPSA id 865B5206F1; Tue, 5 Dec 2017 16:10:39 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v3 06/15] drm/sun4i: Force the mixer rate at 150MHz Date: Tue, 5 Dec 2017 16:10:18 +0100 Message-Id: <12a1d9cbd06783e06a29dade490edd299c6aed78.1512486553.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 , 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 {