From patchwork Wed Jun 11 18:27:03 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4338951 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.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id C827D9F314 for ; Thu, 12 Jun 2014 00:23:33 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 01D10202FE for ; Thu, 12 Jun 2014 00:23:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 3116820320 for ; Thu, 12 Jun 2014 00:23:32 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D47C16E8D0; Wed, 11 Jun 2014 17:23:26 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout3.samsung.com (mailout3.samsung.com [203.254.224.33]) by gabe.freedesktop.org (Postfix) with ESMTP id 2E6456E892 for ; Wed, 11 Jun 2014 11:29:22 -0700 (PDT) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout3.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N700000UOOXM8A0@mailout3.samsung.com> for dri-devel@lists.freedesktop.org; Thu, 12 Jun 2014 03:29:21 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.126]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 21.2A.19452.000A8935; Thu, 12 Jun 2014 03:29:21 +0900 (KST) X-AuditID: cbfee68e-b7fb96d000004bfc-bb-5398a0003417 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id 34.0B.07139.000A8935; Thu, 12 Jun 2014 03:29:20 +0900 (KST) Received: from chromebld-server.sisodomain.com ([107.108.73.106]) by mmp2.samsung.com (Oracle Communications Messaging Server 7u4-24.01(7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTPA id <0N70000F9OO6ED50@mmp2.samsung.com>; Thu, 12 Jun 2014 03:29:20 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, devicetree@vger.kernel.org Subject: [PATCH V4 05/10] drm/bridge: add helper functions to support bridge chain Date: Wed, 11 Jun 2014 23:57:03 +0530 Message-id: <1402511228-18945-6-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> References: <1402511228-18945-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprOIsWRmVeSWpSXmKPExsWyRsSkTpdxwYxggyuHGC0OvD/IYrHhzUJm i4UP7zJbzD9yjtXiytf3bBaT7k9gsfi+6wu7xYzz+5gs5h36zWix6vAGdovnC38wW8w9mGvx c9c8Fgdej9kNF1k89n5bwOKxc9Zddo8Fm0o97ncfZ/Lo27KK0ePzJrkA9igum5TUnMyy1CJ9 uwSujB1TL7EUbJKqOLz9MUsD43KxLkYODgkBE4n118S7GDmBTDGJC/fWs4HYQgJLGSW6n7vB lBz8ywERns4osW6tUhcjF5A9gUni64eXLCAJNgFtiW3Tb7KA1IsIpEg8/8sHUsMs8J1RYvvh h8wgNcICIRL9a/tZQWwWAVWJuW9vge3iFfCQ2Nl4ghVil4LEnEk2ICangKfE7t2BEGs9JP7O a2ABGSkhcI1dYsOkNiaIMQIS3yYfYoFolZXYdIAZ4hNJiYMrbrBMYBRewMiwilE0tSC5oDgp vchIrzgxt7g0L10vOT93EyMwUk7/e9a3g/HmAetDjM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BBd1tLobDnr5sVNRe/OfT9y/2ld7/W/pc3 e7brw/w5X+0W8htK7Ndnkk4725ej33q+N4pdyZxzy2ediTKHeP67eIesjTnoZbR9z7xd06bM 3rfG7fTMc7/PeunkCpw75zX35DKf3QFGSizFGYmGWsxFxYkAiQcRMAkDAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Wed, 11 Jun 2014 17:23:23 -0700 Cc: seanpaul@google.com, daniel.vetter@ffwll.ch, joshi@samsung.com, ajaynumb@gmail.com, marcheu@chromium.org, prashanth.g@samsung.com, Ajay Kumar X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.15 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 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 a7fac56..ba6a0d2 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -640,6 +640,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; @@ -1148,6 +1149,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) \