From patchwork Fri May 9 14:53:00 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4150091 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 54D869F3AE for ; Sun, 11 May 2014 11:04:15 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 80B7A2028D for ; Sun, 11 May 2014 11:04:14 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id 94FCD202F8 for ; Sun, 11 May 2014 11:04:13 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C34F16E894; Sun, 11 May 2014 04:04:09 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout1.samsung.com (mailout1.samsung.com [203.254.224.24]) by gabe.freedesktop.org (Postfix) with ESMTP id 905F46E086 for ; Fri, 9 May 2014 07:54:29 -0700 (PDT) Received: from epcpsbgr2.samsung.com (u142.gpu120.samsung.co.kr [203.254.230.142]) by mailout1.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N5B003R0AQS1D10@mailout1.samsung.com> for dri-devel@lists.freedesktop.org; Fri, 09 May 2014 23:54:28 +0900 (KST) Received: from epcpsbgm2.samsung.com ( [172.20.52.125]) by epcpsbgr2.samsung.com (EPCPMTA) with SMTP id 22.AD.14563.42CEC635; Fri, 09 May 2014 23:54:28 +0900 (KST) X-AuditID: cbfee68e-b7fd86d0000038e3-49-536cec244eb2 Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm2.samsung.com (EPCPMTA) with SMTP id EC.4E.25708.42CEC635; Fri, 09 May 2014 23:54:28 +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 <0N5B00MULAPV2020@mmp2.samsung.com>; Fri, 09 May 2014 23:54:28 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [RFC V3 1/3] drm/bridge: add helper functions to support bridge chain Date: Fri, 09 May 2014 20:23:00 +0530 Message-id: <1399647182-20951-2-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1399647182-20951-1-git-send-email-ajaykumar.rs@samsung.com> References: <1399647182-20951-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFupjkeLIzCtJLcpLzFFi42JZI2JSq6vyJifYoGmWosWtdedYLQ68P8hi seHNQmaLhQ/vMltc+fqezWLS/QksFt93fWG3mHF+H5PFqsMb2C2eL/zBbHF3w1lGB26P2Q0X WTz2flvA4rFz1l12j/vdx5k8+rasYvT4vEkugC2KyyYlNSezLLVI3y6BK+PV9D/sBUekKjpn T2dvYNwu1sXIySEhYCLR8X8yK4QtJnHh3nq2LkYuDiGBpYwS95ZNZ4cpmvD6OVRiOqPExI1H GUESQgITmCR2r5YBsdkEtCW2Tb/JAmKLCLhJNB2eyQrSwCxwj1GiY9I8sBXCAn4SF5c8ZwKx WQRUJXq6prGB2LwCHhKzZ14EauYA2qYgMWeSDUiYU8BT4kPbdiaIXR4S67d9ZoQ46Bi7RNcx ZogxAhLfJh+CapWV2HSAGaJEUuLgihssExiFFzAyrGIUTS1ILihOSi8y0itOzC0uzUvXS87P 3cQIjIvT/5717WC8ecD6EGMy0LiJzFKiyfnAuMoriTc0NjOyMDUxNTYytzQjTVhJnHfRw6Qg IY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TG8t2jtX7sw98YH7t/FBKqf7ZtOLD71Qyn1xsmDzzWFSo /9yru9Ir1M30jkpkKbEUZyQaajEXFScCACbmkHL/AgAA DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Sun, 11 May 2014 04:04:08 -0700 Cc: daniel.vetter@ffwll.ch, joshi@samsung.com, a.hajda@samsung.com, ajaynumb@gmail.com, 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 e55fccb..91ab89c 100644 --- a/include/drm/drm_crtc.h +++ b/include/drm/drm_crtc.h @@ -619,6 +619,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; @@ -1073,6 +1074,77 @@ static inline struct drm_encoder *drm_encoder_find(struct drm_device *dev, return mo ? obj_to_encoder(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) \