From patchwork Sat Oct 10 09:55:23 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 7380831 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 9F1DE9F65E for ; Tue, 13 Oct 2015 02:19:55 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id DC40B20986 for ; Tue, 13 Oct 2015 02:19:54 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 18CE32047C for ; Tue, 13 Oct 2015 02:19:50 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 90537720D7; Mon, 12 Oct 2015 19:19:42 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-pa0-f48.google.com (mail-pa0-f48.google.com [209.85.220.48]) by gabe.freedesktop.org (Postfix) with ESMTPS id B00AA6E824 for ; Sat, 10 Oct 2015 02:56:17 -0700 (PDT) Received: by pablk4 with SMTP id lk4so109425751pab.3 for ; Sat, 10 Oct 2015 02:56:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=from:to:cc:subject:date:message-id:in-reply-to:references; bh=Btu89wJRG4mjGQf9Jko2SZKBK9fQT41vu0ky2bPJ42g=; b=PcJzlFgBp4SjBxECVL8mq043rPDeWmTnuxoRO6YRNkOxdwVg0DuSwyFSdioe6tUFpb jVO03RRSRuFEVgENGhSlXz0wPMJQ2gPY00TZfuXR1kzVIeeP/uI0+kR3sIYj8HhWw3l5 6NxXQfrfoAzpgEkxC09JoDx0mxHAK8WXa28tkU+aBS/NWmqqOqpfW0p8EStFLNSOFW1J P7awcepbpFB+x5lR9LYuBs94tbu3/bQrBxRukA7cbBqqmx7UcNLp0ax8wdA17yfa0cke 04wjuDriPxhW9A4cJ2xBvNteAVP93BbF7DN5PuY1nfHhE6v4hf0XnLRE4q0gtLgwJPd8 /ivA== X-Received: by 10.67.15.100 with SMTP id fn4mr21759631pad.120.1444470977440; Sat, 10 Oct 2015 02:56:17 -0700 (PDT) Received: from localhost.localdomain ([192.253.240.50]) by smtp.gmail.com with ESMTPSA id wi10sm7235351pbc.31.2015.10.10.02.56.12 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Sat, 10 Oct 2015 02:56:16 -0700 (PDT) From: Chris Zhong To: heiko@sntech.de, linux-rockchip@lists.infradead.org Subject: [PATCH 03/10] drm/dsi: Add a helper to get bits per pixel of MIPI DSI pixel format Date: Sat, 10 Oct 2015 17:55:23 +0800 Message-Id: <1444470930-17150-4-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.1 In-Reply-To: <1444470930-17150-1-git-send-email-zyw@rock-chips.com> References: <1444470930-17150-1-git-send-email-zyw@rock-chips.com> X-Mailman-Approved-At: Mon, 12 Oct 2015 19:19:40 -0700 Cc: Chris Zhong , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org 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-Spam-Status: No, score=-4.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: Liu Ying Signed-off-by: Liu Ying Acked-by: Thierry Reding Signed-off-by: Chris Zhong --- include/drm/drm_mipi_dsi.h | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/include/drm/drm_mipi_dsi.h b/include/drm/drm_mipi_dsi.h index f1d8d0d..3662021 100644 --- a/include/drm/drm_mipi_dsi.h +++ b/include/drm/drm_mipi_dsi.h @@ -163,6 +163,20 @@ static inline struct mipi_dsi_device *to_mipi_dsi_device(struct device *dev) return container_of(dev, struct mipi_dsi_device, dev); } +static inline int mipi_dsi_pixel_format_to_bpp(enum mipi_dsi_pixel_format fmt) +{ + switch (fmt) { + case MIPI_DSI_FMT_RGB888: + case MIPI_DSI_FMT_RGB666: + return 24; + case MIPI_DSI_FMT_RGB666_PACKED: + return 18; + case MIPI_DSI_FMT_RGB565: + return 16; + } + return -EINVAL; +} + struct mipi_dsi_device *of_find_mipi_dsi_device_by_node(struct device_node *np); int mipi_dsi_attach(struct mipi_dsi_device *dsi); int mipi_dsi_detach(struct mipi_dsi_device *dsi);