From patchwork Thu Nov 19 03:35:22 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 7656001 Return-Path: X-Original-To: patchwork-dri-devel@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id E3C7FBF90C for ; Thu, 19 Nov 2015 08:51:49 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 20D8820627 for ; Thu, 19 Nov 2015 08:51:48 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 2DF0620618 for ; Thu, 19 Nov 2015 08:51:46 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 95E4D6E8F4; Thu, 19 Nov 2015 00:51:43 -0800 (PST) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-io0-f196.google.com (mail-io0-f196.google.com [209.85.223.196]) by gabe.freedesktop.org (Postfix) with ESMTPS id B24D96E894 for ; Wed, 18 Nov 2015 19:37:32 -0800 (PST) Received: by ioef137 with SMTP id f137so6989560ioe.0 for ; Wed, 18 Nov 2015 19:37:32 -0800 (PST) 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=OePehtQ9KzhCorINLxJc8GDfMMXrIoqT/3TyGvMblcQ=; b=e+FD+cvtEdii7pJevQXNMauHn7CWOl4lkoZ525XjECnmP74XItQjpyccc7N0raAQQd N8cSWxVXukX5ulofWdglkwDxWtrg3xNKDuCBTRw7EtEAAhOmgYEYbIhXi223ydOkHrHk Nj6F2nAA5ENxEzrJs6d1vJGP8e+JfEAx1sX4Pb/IOGzbr8vu4zBDvlz/EhgBr/p4oo+p CokWBZ/v3uT7DI0/doagKZUuvHujvUMG4q1Kjeji55qZLH5EfDSpz14GlkBSe+0uVz6I awRmsEdswQ73hd1XNDjVvPGx01iIOMd8NWyfReZ/8/To0f+C3mWUP4dPmN48yBkjeY3A JX9g== X-Received: by 10.107.158.213 with SMTP id h204mr7739464ioe.129.1447904252049; Wed, 18 Nov 2015 19:37:32 -0800 (PST) Received: from localhost.localdomain ([45.74.60.49]) by smtp.gmail.com with ESMTPSA id n3sm11392131iga.0.2015.11.18.19.37.14 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 18 Nov 2015 19:37:31 -0800 (PST) From: Chris Zhong To: heiko@sntech.de, linux-rockchip@lists.infradead.org, Mark Yao Subject: [PATCH v3 04/12] drm/dsi: Add a helper to get bits per pixel of MIPI DSI pixel format Date: Thu, 19 Nov 2015 11:35:22 +0800 Message-Id: <1447904131-29328-5-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1447904131-29328-1-git-send-email-zyw@rock-chips.com> References: <1447904131-29328-1-git-send-email-zyw@rock-chips.com> X-Mailman-Approved-At: Thu, 19 Nov 2015 00:51:42 -0800 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.8 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_MED, 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 --- Changes in v3: None Changes in v2: None 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);