From patchwork Fri Nov 20 08:15:30 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Zhong X-Patchwork-Id: 7665211 Return-Path: X-Original-To: patchwork-linux-rockchip@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 480AA9F392 for ; Fri, 20 Nov 2015 08:17:24 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 785A020494 for ; Fri, 20 Nov 2015 08:17:23 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.9]) (using TLSv1.2 with cipher AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 95B7D203AE for ; Fri, 20 Nov 2015 08:17:22 +0000 (UTC) Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1Zzgsk-0002iO-3g; Fri, 20 Nov 2015 08:17:22 +0000 Received: from mail-ig0-f194.google.com ([209.85.213.194]) by bombadil.infradead.org with esmtps (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZzgsL-0002U3-JD for linux-rockchip@lists.infradead.org; Fri, 20 Nov 2015 08:17:00 +0000 Received: by igbmn7 with SMTP id mn7so806771igb.3 for ; Fri, 20 Nov 2015 00:16:36 -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=zyb7jBh68/uBmh7a+Ate4E4GmSrzUcuRwrOVXbSaWnE=; b=cD60g8lqj6t3NZNQSUPK0BPtFRTHA2BbzkPgZlK9ersuZJjfon2FrHFNItxzp03Lq3 9VZ9Ap8ct2t36R4n8F6vGXMYJOATQ3UvYdSIqe6jMThO/QE3BcmpMP9m9q2FKlxxYBDE L8sQ+MbYKGUiNRJxidTTvLxLSJLrhmBWzHvDhQq6GstMT6BYE4fQr9pUi+EvhOogKlEH 4QmQUPrjuBgHxlMs/tSmemPhLWQ78lNpTZ2e+xMKYt8qEPdKNe+RHnLdnJgh0Wz6FNfH yIzV6h6arYn1CIGztvyarASal0pSdUHX8PyQQzEi6ubbTrfZ8z7Z2e+yCqv0E5QbIGKe j+VQ== X-Received: by 10.50.61.230 with SMTP id t6mr601394igr.28.1448007396677; Fri, 20 Nov 2015 00:16:36 -0800 (PST) Received: from localhost.localdomain ([45.74.60.24]) by smtp.gmail.com with ESMTPSA id b10sm696026igx.19.2015.11.20.00.16.29 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Fri, 20 Nov 2015 00:16:35 -0800 (PST) From: Chris Zhong To: heiko@sntech.de, linux-rockchip@lists.infradead.org, mark.yao@rock-chips.com, treding@nvidia.com, emil.l.velikov@gmail.com Subject: [PATCH v4 04/13] drm/dsi: Add a helper to get bits per pixel of MIPI DSI pixel format Date: Fri, 20 Nov 2015 16:15:30 +0800 Message-Id: <1448007339-10966-5-git-send-email-zyw@rock-chips.com> X-Mailer: git-send-email 2.6.3 In-Reply-To: <1448007339-10966-1-git-send-email-zyw@rock-chips.com> References: <1448007339-10966-1-git-send-email-zyw@rock-chips.com> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20151120_001657_942121_3009315F X-CRM114-Status: UNSURE ( 7.68 ) X-CRM114-Notice: Please train this message. X-Spam-Score: -2.2 (--) X-BeenThere: linux-rockchip@lists.infradead.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: Upstream kernel work for Rockchip platforms List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: airlied@linux.ie, linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Chris Zhong , rmk+kernel@arm.linux.org.uk, Liu Ying , ajaykumar.rs@samsung.com MIME-Version: 1.0 Sender: "Linux-rockchip" Errors-To: linux-rockchip-bounces+patchwork-linux-rockchip=patchwork.kernel.org@lists.infradead.org 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 v4: None 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);