From patchwork Tue Aug 14 13:49:59 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulrich Hecht X-Patchwork-Id: 10565637 X-Patchwork-Delegate: horms@verge.net.au Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 93A4F17E1 for ; Tue, 14 Aug 2018 13:50:48 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 885E529D0F for ; Tue, 14 Aug 2018 13:50:48 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7C77429D87; Tue, 14 Aug 2018 13:50:48 +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=-7.8 required=2.0 tests=BAYES_00,DKIM_SIGNED, MAILING_LIST_MULTI,RCVD_IN_DNSWL_HI,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 29FFF29DE1 for ; Tue, 14 Aug 2018 13:50:47 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1732699AbeHNQiC (ORCPT ); Tue, 14 Aug 2018 12:38:02 -0400 Received: from mo4-p02-ob.smtp.rzone.de ([85.215.255.81]:32001 "EHLO mo4-p02-ob.smtp.rzone.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1732743AbeHNQiB (ORCPT ); Tue, 14 Aug 2018 12:38:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; t=1534254644; s=strato-dkim-0002; d=fpond.eu; h=References:In-Reply-To:Message-Id:Date:Subject:Cc:To:From: X-RZG-CLASS-ID:X-RZG-AUTH:From:Subject:Sender; bh=KfHc0q+Ptt2HNk05xvNEh9kZkYbTXZkB/NZr4YgrITc=; b=QE7Svbf2fGnE0H7Kq3RO+U7BWKf2DJCLQdr7diRtJNSPmQUqD4uW1fL4jfuRp7XwKR 4yGokJtqeaoN24Syphk9+e/EovW2HJvNYBb4498J0PnGOk+EjRxlg1JcyrS8kWyPQCco VfRFXCkjR5INfPu2s9MUbzThx/kMnau43cVpDTG/X4ri869OjfCzTbeMIZyzl99sp85r ejPd8v38fUH6fgQpeC8bru2EP7obVi7FxmG5dbmAVFj5pnUkyr0y9I4ENRD5vRyFwTtY HP7SQIckagNGI23nzPs7oRN7PY6SQrqIeSAwTRncTiOC7GWARlOv1KiAzD+9ozPwtK0u ETpQ== X-RZG-AUTH: ":OWANVUa4dPFUgKR/3dpvnYP0Np73dmm4I5W0/AvA67Ot4fvR82tad/Qd" X-RZG-CLASS-ID: mo00 Received: from groucho.site by smtp.strato.de (RZmta 43.18 DYNA|AUTH) with ESMTPSA id w02b1cu7EDob0JD (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA (curve secp521r1 with 521 ECDH bits, eq. 15360 bits RSA)) (Client did not present a certificate); Tue, 14 Aug 2018 15:50:37 +0200 (CEST) From: Ulrich Hecht To: laurent.pinchart@ideasonboard.com Cc: linux-renesas-soc@vger.kernel.org, dri-devel@lists.freedesktop.org, jacopo+renesas@jmondi.org, kieran.bingham+renesas@ideasonboard.com, Koji Matsuoka , Ulrich Hecht Subject: [PROTO][PATCH 05/10] drm/bridge: adv7511: Add max-clock, min-vrefresh options Date: Tue, 14 Aug 2018 15:49:59 +0200 Message-Id: <1534254604-24204-6-git-send-email-uli+renesas@fpond.eu> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1534254604-24204-1-git-send-email-uli+renesas@fpond.eu> References: <1534254604-24204-1-git-send-email-uli+renesas@fpond.eu> Sender: linux-renesas-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-renesas-soc@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Koji Matsuoka This patch adds the option to specify a maximal clock and a minimal vertical refresh rate. Signed-off-by: Koji Matsuoka [uli: renamed properties, fixed transposed parsing] Signed-off-by: Ulrich Hecht --- drivers/gpu/drm/bridge/adv7511/adv7511.h | 7 +++++++ drivers/gpu/drm/bridge/adv7511/adv7511_drv.c | 22 ++++++++++++++++++++++ 2 files changed, 29 insertions(+) diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511.h b/drivers/gpu/drm/bridge/adv7511/adv7511.h index 73d8ccb..7f29d4f 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511.h +++ b/drivers/gpu/drm/bridge/adv7511/adv7511.h @@ -271,6 +271,8 @@ enum adv7511_sync_polarity { * @sync_pulse: Select the sync pulse * @vsync_polarity: vsync input signal configuration * @hsync_polarity: hsync input signal configuration + * @min_vrefresh_option: min vrefresh option + * @max_freq_option: max frequency option */ struct adv7511_link_config { unsigned int input_color_depth; @@ -285,6 +287,9 @@ struct adv7511_link_config { enum adv7511_input_sync_pulse sync_pulse; enum adv7511_sync_polarity vsync_polarity; enum adv7511_sync_polarity hsync_polarity; + + unsigned int min_vrefresh_option; + unsigned int max_freq_option; }; /** @@ -354,6 +359,8 @@ struct adv7511 { enum adv7511_sync_polarity vsync_polarity; enum adv7511_sync_polarity hsync_polarity; bool rgb; + unsigned int min_vref; + unsigned int max_freq; struct gpio_desc *gpio_pd; diff --git a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c index 6437b87..2938b02 100644 --- a/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c +++ b/drivers/gpu/drm/bridge/adv7511/adv7511_drv.c @@ -323,6 +323,8 @@ static void adv7511_set_link_config(struct adv7511 *adv7511, adv7511->hsync_polarity = config->hsync_polarity; adv7511->vsync_polarity = config->vsync_polarity; adv7511->rgb = config->input_colorspace == HDMI_COLORSPACE_RGB; + adv7511->min_vref = config->min_vrefresh_option; + adv7511->max_freq = config->max_freq_option; } static void __adv7511_power_on(struct adv7511 *adv7511) @@ -660,6 +662,16 @@ static enum drm_mode_status adv7511_mode_valid(struct adv7511 *adv7511, if (mode->clock > 165000) return MODE_CLOCK_HIGH; + if (adv7511->max_freq) { + if (mode->clock > (adv7511->max_freq / 1000)) + return MODE_CLOCK_HIGH; + } + + if (adv7511->min_vref) { + if (drm_mode_vrefresh(mode) < adv7511->min_vref) + return MODE_BAD; + } + return MODE_OK; } @@ -1074,6 +1086,16 @@ static int adv7511_parse_dt(struct device_node *np, config->vsync_polarity = ADV7511_SYNC_POLARITY_PASSTHROUGH; config->hsync_polarity = ADV7511_SYNC_POLARITY_PASSTHROUGH; + ret = of_property_read_u32(np, "max-clock", + &config->max_freq_option); + if (ret < 0) + config->max_freq_option = 0; + + ret = of_property_read_u32(np, "min-vrefresh", + &config->min_vrefresh_option); + if (ret < 0) + config->min_vrefresh_option = 0; + return 0; }