From patchwork Thu Jul 17 20:43:52 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4578821 Return-Path: X-Original-To: patchwork-linux-samsung-soc@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 6E4FFC0514 for ; Thu, 17 Jul 2014 20:47:11 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8E5942011E for ; Thu, 17 Jul 2014 20:47:10 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 933A320160 for ; Thu, 17 Jul 2014 20:47:09 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752862AbaGQUrJ (ORCPT ); Thu, 17 Jul 2014 16:47:09 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:59355 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752816AbaGQUrI (ORCPT ); Thu, 17 Jul 2014 16:47:08 -0400 Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N8V00A2AJ2I8N90@mailout1.samsung.com> for linux-samsung-soc@vger.kernel.org; Fri, 18 Jul 2014 05:47:06 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 74.05.14704.A4638C35; Fri, 18 Jul 2014 05:47:06 +0900 (KST) X-AuditID: cbfee68f-b7fef6d000003970-b8-53c8364a685d Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id C0.D6.05196.A4638C35; Fri, 18 Jul 2014 05:47:06 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp1.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N8V002BCJ1T7D60@mmp1.samsung.com>; Fri, 18 Jul 2014 05:47:06 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Cc: inki.dae@samsung.com, robdclark@gmail.com, daniel.vetter@ffwll.ch, thierry.reding@gmail.com, seanpaul@google.com, ajaynumb@gmail.com, jg1.han@samsung.com, joshi@samsung.com, prashanth.g@samsung.com, javier@dowhile0.org, Ajay Kumar Subject: [RESEND PATCH V5 06/12] drm/bridge: add helper functions to support bridge chain Date: Fri, 18 Jul 2014 02:13:52 +0530 Message-id: <1405629839-12086-7-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> References: <1405629839-12086-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsWyRsSkVtfL7ESwwY+rkhYH3h9ksdjwZiGz xcKHd5ktrnx9z2Yx6f4EFotrv2ewWVxeeInV4vuuL+wWM87vY7JYdXgDu8XzhT+YLeYezLX4 uWseiwOvx9/Zrcwee78tYPHYOesuu8eCTaUe97uPM3n0bVnF6PF5k1wAexSXTUpqTmZZapG+ XQJXxr8zbgWbpCr+zt3K3sC4XKyLkZNDQsBEYvXLk6wQtpjEhXvr2boYuTiEBJYyStza1sEC U7Ry32JmiMQiRonu7s0sEM4EJom1C38zglSxCWhLbJt+E6xDRMBNounwTFaQImaBbiaJfffO giWEBaIlHs6byARiswioSqw8uJcNxOYV8JC43HwWKM4BtE5BYs4kG5Awp4CnxMzOH2CtQkAl P3d/B7tCQuAau8SMze8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aCQQHpiSWp2ampBahFMHxMHp1QDo9+5vLnm RwvilQ63+B/crzBf8eu6omMvr6RFxSnf63Vbfblxre1Ch950wR3KVlJ/l29Y9OX0paLdvH6X Pd7t/OF9SWTB//U9H8qazrOdPvCg3SvPqnHjoj3iHo55d1dl/1pex5lzdsm2F9OjVq/bn/s/ WanKd5mzvGG17t9s/hnyam9Utj5Zy6jEUpyRaKjFXFScCAB+6ZJa3gIAAA== DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected Sender: linux-samsung-soc-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, 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 Add helper functions to create bridge chain and to call the corresponding next_bridge functions. Signed-off-by: Ajay Kumar Suggested-by: Rob Clark --- include/drm/drm_crtc.h | 72 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 72 insertions(+) diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e529b68..0a6950a 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -652,6 +652,7 @@ struct drm_bridge_funcs { struct drm_bridge { struct drm_device *dev; struct list_head head; + struct drm_bridge *next_bridge; struct drm_mode_object base; @@ -1166,6 +1167,77 @@ drm_property_blob_find(struct drm_device *dev, uint32_t id) return mo ? obj_to_blob(mo) : NULL; } +static inline int drm_bridge_add_to_chain(struct drm_bridge *head, + struct drm_bridge *last) +{ + struct drm_bridge *temp = head; + + if (head && last) { + while (temp->next_bridge) + temp = temp->next_bridge; + + temp->next_bridge = last; + return 0; + } + + return -EINVAL; +} + +static inline void drm_next_bridge_mode_fixup(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->mode_fixup) + bridge->next_bridge->funcs->mode_fixup(bridge->next_bridge, + mode, adjusted_mode); +} + +static inline void drm_next_bridge_disable(struct drm_bridge *bridge) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->disable) + bridge->next_bridge->funcs->disable(bridge->next_bridge); +} + +static inline void drm_next_bridge_post_disable(struct drm_bridge *bridge) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->post_disable) + bridge->next_bridge->funcs->post_disable(bridge->next_bridge); +} + +static inline void drm_next_bridge_mode_set(struct drm_bridge *bridge, + struct drm_display_mode *mode, + struct drm_display_mode *adjusted_mode) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->mode_set) + bridge->next_bridge->funcs->mode_set(bridge->next_bridge, + mode, adjusted_mode); +} + +static inline void drm_next_bridge_pre_enable(struct drm_bridge *bridge) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->pre_enable) + bridge->next_bridge->funcs->pre_enable(bridge->next_bridge); +} + +static inline void drm_next_bridge_enable(struct drm_bridge *bridge) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->enable) + bridge->next_bridge->funcs->enable(bridge->next_bridge); +} + +static inline void drm_next_bridge_destroy(struct drm_bridge *bridge) +{ + if (bridge && bridge->next_bridge && bridge->next_bridge->funcs && + bridge->next_bridge->funcs->destroy) + bridge->next_bridge->funcs->destroy(bridge->next_bridge); +} + /* Plane list iterator for legacy (overlay only) planes. */ #define drm_for_each_legacy_plane(plane, planelist) \ list_for_each_entry(plane, planelist, head) \