From patchwork Thu Nov 17 01:35:25 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Stefan Agner X-Patchwork-Id: 9433361 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id C833860469 for ; Thu, 17 Nov 2016 01:35:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B912029002 for ; Thu, 17 Nov 2016 01:35:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id AE279291D4; Thu, 17 Nov 2016 01:35:41 +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=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID 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 756C1291D7 for ; Thu, 17 Nov 2016 01:35:41 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DB2AB6E6BE; Thu, 17 Nov 2016 01:35:37 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail.kmu-office.ch (mail.kmu-office.ch [IPv6:2a02:418:6a02::a2]) by gabe.freedesktop.org (Postfix) with ESMTPS id 4BCEE6E6BC for ; Thu, 17 Nov 2016 01:35:33 +0000 (UTC) Received: from trochilidae.toradex.int (75-146-58-181-Washington.hfc.comcastbusiness.net [75.146.58.181]) by mail.kmu-office.ch (Postfix) with ESMTPSA id 310865C13DB; Thu, 17 Nov 2016 02:28:29 +0100 (CET) From: Stefan Agner To: dri-devel@lists.freedesktop.org Subject: [PATCH 2/2] drm/fsl-dcu: introduce kernel parameter to specify fbdev depth Date: Wed, 16 Nov 2016 17:35:25 -0800 Message-Id: <20161117013525.6452-2-stefan@agner.ch> X-Mailer: git-send-email 2.10.2 In-Reply-To: <20161117013525.6452-1-stefan@agner.ch> References: <20161117013525.6452-1-stefan@agner.ch> DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=agner.ch; s=dkim; t=1479346110; bh=gIA8dwzIkdsZkM6rdJkoWLyP3jDz9r3gaIi5AbswWuQ=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References; b=gZwp8ISjO+9C4uWmT2QuJ1UqGbnFVHTd9hdJ267aXJKURtPc4OkqOq4vxg2I47+hhyOAGox+oPtrIkp3LTQcgJiApjOJFO5559YxxB0OviA0OSq4HxgV9KX1zK2rZYhKKPvgGPwBgfjC3j8bwmylEgO4Md0EGCwBhAJXRGcczUk= Cc: meng.yi@nxp.com, linux-kernel@vger.kernel.org, alison.wang@freescale.com 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" X-Virus-Scanned: ClamAV using ClamSMTP Add a kernel parameter legancyfb_depth (like the i.MX drm driver) to control the legancy fbdev depth. Default to the so far hard coded depth of 24-bit. Currently changing the framebuffer depth is not possible from user space when using the fbdev emulation layer... This provides a rudimentary mechanism to change depth without having to change kernel code. Signed-off-by: Stefan Agner --- drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c index c3c9349..537ca15 100644 --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c @@ -32,6 +32,9 @@ #include "fsl_dcu_drm_drv.h" #include "fsl_tcon.h" +static int legacyfb_depth = 24; +module_param(legacyfb_depth, int, 0444); + static bool fsl_dcu_drm_is_volatile_reg(struct device *dev, unsigned int reg) { if (reg == DCU_INT_STATUS || reg == DCU_UPDATE_MODE) @@ -85,7 +88,18 @@ static int fsl_dcu_load(struct drm_device *dev, unsigned long flags) goto done; dev->irq_enabled = true; - fsl_dev->fbdev = drm_fbdev_cma_init(dev, 24, 1, 1); + if (legacyfb_depth != 16 && legacyfb_depth != 24 && + legacyfb_depth != 32) { + dev_warn(dev->dev, + "Invalid legacyfb_depth. Defaulting to 24bpp\n"); + legacyfb_depth = 24; + } + fsl_dev->fbdev = drm_fbdev_cma_init(dev, legacyfb_depth, 1, 1); + if (IS_ERR(fsl_dev->fbdev)) { + ret = PTR_ERR(fsl_dev->fbdev); + fsl_dev->fbdev = NULL; + goto done; + } return 0; done: