From patchwork Tue Dec 18 15:37:38 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lubomir Rintel X-Patchwork-Id: 10736895 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 BA3771399 for ; Wed, 19 Dec 2018 08:41:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id AA0BD2AEB9 for ; Wed, 19 Dec 2018 08:41:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 9E1992AEE3; Wed, 19 Dec 2018 08:41:42 +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,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 089F92AEF5 for ; Wed, 19 Dec 2018 08:41:42 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 44B356EE41; Wed, 19 Dec 2018 08:41:28 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from shell.v3.sk (shell.v3.sk [90.176.6.54]) by gabe.freedesktop.org (Postfix) with ESMTPS id C16FC6EC42 for ; Tue, 18 Dec 2018 15:38:24 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 7A6C3CA1DE; Tue, 18 Dec 2018 16:38:23 +0100 (CET) Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10032) with ESMTP id ii5O7cdBoAAk; Tue, 18 Dec 2018 16:38:12 +0100 (CET) Received: from localhost (localhost [127.0.0.1]) by zimbra.v3.sk (Postfix) with ESMTP id 39665CA2D1; Tue, 18 Dec 2018 16:37:55 +0100 (CET) X-Virus-Scanned: amavisd-new at zimbra.v3.sk Received: from shell.v3.sk ([127.0.0.1]) by localhost (zimbra.v3.sk [127.0.0.1]) (amavisd-new, port 10026) with ESMTP id nUJcZn0AYc2l; Tue, 18 Dec 2018 16:37:52 +0100 (CET) Received: from belphegor.brq.redhat.com (nat-pool-brq-t.redhat.com [213.175.37.10]) by zimbra.v3.sk (Postfix) with ESMTPSA id 8262ECA2DE; Tue, 18 Dec 2018 16:37:47 +0100 (CET) From: Lubomir Rintel To: dri-devel@lists.freedesktop.org Subject: [RFC 12/16] drm/armada: add bus-width property to the output endpoint Date: Tue, 18 Dec 2018 16:37:38 +0100 Message-Id: <20181218153742.1313125-13-lkundrak@v3.sk> X-Mailer: git-send-email 2.19.1 In-Reply-To: <20181218153742.1313125-1-lkundrak@v3.sk> References: <20181218153742.1313125-1-lkundrak@v3.sk> MIME-Version: 1.0 X-Mailman-Approved-At: Wed, 19 Dec 2018 08:40:40 +0000 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: Lubomir Rintel , Russell King , James Cameron Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" X-Virus-Scanned: ClamAV using ClamSMTP This makes it possible to choose a different pixel format for the endpoint. Modelled after what other LCD controllers use, including marvell,pxa2xx-lcdc and atmel,hlcdc-display-controller and perhaps more. Signed-off-by: Lubomir Rintel --- drivers/gpu/drm/armada/armada_crtc.c | 26 +++++++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/armada/armada_crtc.c b/drivers/gpu/drm/armada/armada_crtc.c index da9360688b55..5400fb925bcd 100644 --- a/drivers/gpu/drm/armada/armada_crtc.c +++ b/drivers/gpu/drm/armada/armada_crtc.c @@ -724,6 +724,8 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, struct armada_private *priv = drm->dev_private; struct armada_crtc *dcrtc; struct drm_plane *primary; + struct device_node *endpoint; + u32 bus_width = 24; void __iomem *base; int ret; @@ -744,8 +746,30 @@ static int armada_drm_crtc_create(struct drm_device *drm, struct device *dev, dcrtc->base = base; dcrtc->num = drm->mode_config.num_crtc; dcrtc->clk = ERR_PTR(-EINVAL); - dcrtc->cfg_dumb_ctrl = DUMB24_RGB888_0; dcrtc->spu_iopad_ctrl = CFG_VSCALE_LN_EN | CFG_IOPAD_DUMB24; + + endpoint = of_get_next_child(port, NULL); + of_property_read_u32(endpoint, "bus-width", &bus_width); + of_node_put(endpoint); + + switch (bus_width) { + case 12: + dcrtc->cfg_dumb_ctrl = DUMB12_RGB444_0; + break; + case 16: + dcrtc->cfg_dumb_ctrl = DUMB16_RGB565_0; + break; + case 18: + dcrtc->cfg_dumb_ctrl = DUMB18_RGB666_0; + break; + case 24: + dcrtc->cfg_dumb_ctrl = DUMB24_RGB888_0; + break; + default: + DRM_ERROR("unsupported bus width: %d\n", bus_width); + return -EINVAL; + } + spin_lock_init(&dcrtc->irq_lock); dcrtc->irq_ena = CLEAN_SPU_IRQ_ISR;