From patchwork Fri May 10 19:42:29 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Adam Ford X-Patchwork-Id: 10939791 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 91F5B1398 for ; Sat, 11 May 2019 18:23:02 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 81710206AF for ; Sat, 11 May 2019 18:23:02 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7558C212E8; Sat, 11 May 2019 18:23:02 +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=-5.2 required=2.0 tests=BAYES_00,DKIM_ADSP_CUSTOM_MED, FREEMAIL_FROM,MAILING_LIST_MULTI,RCVD_IN_DNSWL_MED 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 18234206AF for ; Sat, 11 May 2019 18:23:02 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id BC2BF895B2; Sat, 11 May 2019 18:22:58 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by gabe.freedesktop.org (Postfix) with ESMTPS id 1437E89EB7 for ; Fri, 10 May 2019 19:42:49 +0000 (UTC) Received: by mail-io1-xd41.google.com with SMTP id g84so5438618ioa.1 for ; Fri, 10 May 2019 12:42:49 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=YO5aV9RNmEsHE9amrXyCgHA1u0E4O0knkwps7WnuFv0=; b=Ejt8mmcA/5mXcEjKnbJwssXDj9zgkZ7U/lPf805F55Uw2i83imRJ1mO8tXFhUawS/g yr+AKlOlKDj6CkGRIgfvqejT3Nrix/5pDOFKufvm4AZ4YyGy1fsbwhAVnFJMjIVGdFRw VqiD5i/110cMJ8UM4CXAuJN6MbpJ5c8UwSAmZoLR6z8GrZf5yFXL01/KDidAMiGwx6wS gSdWlnY1R+NX6n1JTdr62aKwk598chutSTyxgY+FaNkNJdpUk8yDdtQBBteE15R410KY HltgexMsYHAQDBs84/FRSCpLmpWLdsAoVxUVqPWBOBQlgoLL5dkDdVqrt1M2xewQ8yVF X7tQ== X-Gm-Message-State: APjAAAWu8xWYcR6U4FFt+1gdC2D8ui4/vTwC4L9Iuz6Qoq+gMOlVaMcB YD2GwcN+Kf4U3ls6WTsl7QI= X-Google-Smtp-Source: APXvYqx5kbQ9jaDVLMe+fwt230a/4Euni6CMHlf+lRjuzrr3etdu9O2C4gXTKyCTCM8O97vANKQlUw== X-Received: by 2002:a6b:5b0f:: with SMTP id v15mr8502059ioh.82.1557517368203; Fri, 10 May 2019 12:42:48 -0700 (PDT) Received: from localhost.localdomain (c-73-37-219-234.hsd1.mn.comcast.net. [73.37.219.234]) by smtp.gmail.com with ESMTPSA id p184sm2845331itb.2.2019.05.10.12.42.46 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 10 May 2019 12:42:47 -0700 (PDT) From: Adam Ford To: linux-omap@vger.kernel.org Subject: [PATCH] drm/omap: Migrate minimum FCK/PCK ratio from Kconfig to dts Date: Fri, 10 May 2019 14:42:29 -0500 Message-Id: <20190510194229.20628-1-aford173@gmail.com> X-Mailer: git-send-email 2.17.1 X-Mailman-Approved-At: Sat, 11 May 2019 18:22:57 +0000 X-Mailman-Original-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id; bh=YO5aV9RNmEsHE9amrXyCgHA1u0E4O0knkwps7WnuFv0=; b=BCDPaaEqvrLXcSGRWr5S3MZNdOouK+RphRlWHZ5/MqyPJSq1/rPiTHnFk5GulaQEYW 9ZrqoezOIM8sO+Oo/+S/zlh28o8gSbW66OlRlIM/argXlA3WQx10wZtdOpEM6Qp52bRM EZq/+WrL1PR4EM+D2SAXqa3DpEuELlep0Gx0zLQa/N9OohVwJ+bY2J0dBMxyXvYWBhSH XvXtqFssBfQw5o7/5tHjkfl+bxC3Md0PWk5wHdZZUv+Wqx65XFIXoATFvlqqbGfuVsnq z2utpcJsI+XxLd1wiEtgIQI+CcPVT0hRStWY4FYKktl1IxFQLqY7W4VugQaawX/kYfHz 1tdQ== 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: Mark Rutland , devicetree@vger.kernel.org, =?utf-8?q?Beno=C3=AEt_Cousson?= , David Airlie , adam.ford@logicpd.com, linux-kernel@vger.kernel.org, Rob Herring , Tony Lindgren , Tomi Valkeinen , dri-devel@lists.freedesktop.org, Adam Ford MIME-Version: 1.0 Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP Currently the source code is compiled using hard-coded values from CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK. This patch allows this clock divider value to be moved to the device tree and be changed without having to recompile the kernel. Signed-off-by: Adam Ford diff --git a/Documentation/devicetree/bindings/display/ti/ti,omap3-dss.txt b/Documentation/devicetree/bindings/display/ti/ti,omap3-dss.txt index cd02516a40b6..42449d07c47e 100644 --- a/Documentation/devicetree/bindings/display/ti/ti,omap3-dss.txt +++ b/Documentation/devicetree/bindings/display/ti/ti,omap3-dss.txt @@ -40,7 +40,7 @@ Required properties: Optional properties: - max-memory-bandwidth: Input memory (from main memory to dispc) bandwidth limit in bytes per second - +- min-fck-pck-ratio: Make sure that DISPC FCK is at least n x PCK RFBI ---- diff --git a/arch/arm/boot/dts/omap3.dtsi b/arch/arm/boot/dts/omap3.dtsi index 4043ecb38016..bf84a8487aae 100644 --- a/arch/arm/boot/dts/omap3.dtsi +++ b/arch/arm/boot/dts/omap3.dtsi @@ -751,7 +751,7 @@ #size-cells = <1>; ranges; - dispc@48050400 { + dispc: dispc@48050400 { compatible = "ti,omap3-dispc"; reg = <0x48050400 0x400>; interrupts = <25>; diff --git a/drivers/gpu/drm/omapdrm/dss/Kconfig b/drivers/gpu/drm/omapdrm/dss/Kconfig index f24ebf7f61dd..d0666edcdf2a 100644 --- a/drivers/gpu/drm/omapdrm/dss/Kconfig +++ b/drivers/gpu/drm/omapdrm/dss/Kconfig @@ -102,24 +102,6 @@ config OMAP2_DSS_DSI See http://www.mipi.org/ for DSI specifications. -config OMAP2_DSS_MIN_FCK_PER_PCK - int "Minimum FCK/PCK ratio (for scaling)" - range 0 32 - default 0 - help - This can be used to adjust the minimum FCK/PCK ratio. - - With this you can make sure that DISPC FCK is at least - n x PCK. Video plane scaling requires higher FCK than - normally. - - If this is set to 0, there's no extra constraint on the - DISPC FCK. However, the FCK will at minimum be - 2xPCK (if active matrix) or 3xPCK (if passive matrix). - - Max FCK is 173MHz, so this doesn't work if your PCK - is very high. - config OMAP2_DSS_SLEEP_AFTER_VENC_RESET bool "Sleep 20ms after VENC reset" default y diff --git a/drivers/gpu/drm/omapdrm/dss/dispc.c b/drivers/gpu/drm/omapdrm/dss/dispc.c index ba82d916719c..09a130c53da2 100644 --- a/drivers/gpu/drm/omapdrm/dss/dispc.c +++ b/drivers/gpu/drm/omapdrm/dss/dispc.c @@ -198,6 +198,9 @@ struct dispc_device { /* DISPC_CONTROL & DISPC_CONFIG lock*/ spinlock_t control_lock; + + /* Optional min-fck-pck-ratio */ + u32 min_fck_per_pck; }; enum omap_color_component { @@ -3683,15 +3686,8 @@ bool dispc_div_calc(struct dispc_device *dispc, unsigned long dispc_freq, unsigned long pck, lck; unsigned long lck_max; unsigned long pckd_hw_min, pckd_hw_max; - unsigned int min_fck_per_pck; unsigned long fck; -#ifdef CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK - min_fck_per_pck = CONFIG_OMAP2_DSS_MIN_FCK_PER_PCK; -#else - min_fck_per_pck = 0; -#endif - pckd_hw_min = dispc->feat->min_pcd; pckd_hw_max = 255; @@ -3723,7 +3719,7 @@ bool dispc_div_calc(struct dispc_device *dispc, unsigned long dispc_freq, else fck = lck; - if (fck < pck * min_fck_per_pck) + if (fck < pck * dispc->min_fck_per_pck) continue; if (func(lckd, pckd, lck, pck, data)) @@ -4826,6 +4822,8 @@ static int dispc_bind(struct device *dev, struct device *master, void *data) } } + of_property_read_u32(np, "min-fck-pck-ratio", &dispc->min_fck_per_pck); + r = dispc_init_gamma_tables(dispc); if (r) goto err_free;