From patchwork Thu Dec 21 11:02:31 2017 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Maxime Ripard X-Patchwork-Id: 122536 Delivered-To: patch@linaro.org Received: by 10.140.22.227 with SMTP id 90csp725868qgn; Thu, 21 Dec 2017 03:03:58 -0800 (PST) X-Google-Smtp-Source: ACJfBouiWjeoMHvIVQqOne7eAf0z0c/8uIzIwd1YkOJS8zM281EX+6DN9m/HAHT/PV2f9krDLzNP X-Received: by 10.99.115.93 with SMTP id d29mr9335460pgn.345.1513854237977; Thu, 21 Dec 2017 03:03:57 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1513854237; cv=none; d=google.com; s=arc-20160816; b=SmHwABPLH+f2bnITWhzbokXgS6p2oOK0dJ3DG2VSUcieRg2qOLBULhp11cwP/0wEG9 1OruYeI/+plwk+ffCJutbLYFsQQFjN6BHQEwVnri/PyDT6YIpkqbQqUTzL9Azai8+aT8 fGoYOdujOGdYk3m69VF1oyZhj0aWw144bqoRDDoKUpc6OtYOTo5G+iipTaNZ4ImCsUuq AAkvIH39hBGT88VHBZxPKsrr2C11ovWmf1MCIqFW8OPSOD2OciCueaz4OhruHeY/T1lW vXkZHVprD46uxTKQu9CMFXDCM7kbwKq5oleJzsSFFqCHA6J10qxBReF+XfeAHU5p3rgw Nytw== 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=KWlVKOuu1gqRCz9NLnJ9tNvLUPk0gFBV3kpSziG8DWc=; b=HqAf3WqmMXFLDvxgsZ7BBcuwcZS3AkAGr83HJydwEGk+PQgm1SKOjfvubSBCQ+IPPj cs5CyF6qK3DSNfxeodaI41JQpCeQdPh76fi9ZNh2okJouZCSJPQQjnHHxuLy+f1OcyHN a4eAj7ZYWKXa2lanrTqF3VmGjLWhArMSygRO1gjePd5x3lC8nvC01pz2+sQiFOVaig0b LESPLEKLiFcxrVzITjP5DmAsQLyU30HZJi38ck5FQF1/A1npAGCC46I0WdtpOZlqNL+M 0fNbhWxl6g5w8B45EdToI99deR9FsnfeLwUkM2MDcgciWR5pYQD8M4t8VaT3H6At5Qw1 /WwQ== 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 x21si14829154pfa.129.2017.12.21.03.03.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 21 Dec 2017 03:03:57 -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 325876E616; Thu, 21 Dec 2017 11:03:08 +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 1CC416E60F for ; Thu, 21 Dec 2017 11:03:04 +0000 (UTC) Received: by mail.free-electrons.com (Postfix, from userid 110) id C9D43209B1; Thu, 21 Dec 2017 12:03:02 +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 B35A5207F3; Thu, 21 Dec 2017 12:02:44 +0100 (CET) From: Maxime Ripard To: Daniel Vetter , David Airlie , Chen-Yu Tsai , Maxime Ripard Subject: [PATCH v5 05/12] drm/sun4i: Force the mixer rate at 150MHz Date: Thu, 21 Dec 2017 12:02:31 +0100 Message-Id: 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, Laurent Pinchart , 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. Reviewed-by: Chen-Yu Tsai Signed-off-by: Maxime Ripard --- drivers/gpu/drm/sun4i/sun8i_mixer.c | 10 ++++++++++ drivers/gpu/drm/sun4i/sun8i_mixer.h | 3 +++ 2 files changed, 13 insertions(+) diff --git a/drivers/gpu/drm/sun4i/sun8i_mixer.c b/drivers/gpu/drm/sun4i/sun8i_mixer.c index 29ceeb016d72..3a610a87cbd2 100644 --- a/drivers/gpu/drm/sun4i/sun8i_mixer.c +++ b/drivers/gpu/drm/sun4i/sun8i_mixer.c @@ -398,6 +398,15 @@ static int sun8i_mixer_bind(struct device *dev, struct device *master, ret = PTR_ERR(mixer->mod_clk); goto err_disable_bus_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); + clk_prepare_enable(mixer->mod_clk); list_add_tail(&mixer->engine.list, &drv->engine_list); @@ -474,6 +483,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 {