From patchwork Mon May 5 19:52:26 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ajay Kumar X-Patchwork-Id: 4122581 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 10B7F9F387 for ; Tue, 6 May 2014 15:51:26 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 18BAD2024C for ; Tue, 6 May 2014 15:51:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.kernel.org (Postfix) with ESMTP id EB24C2022A for ; Tue, 6 May 2014 15:51:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id F0B3B6E6F0; Tue, 6 May 2014 08:51:19 -0700 (PDT) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mailout4.samsung.com (mailout4.samsung.com [203.254.224.34]) by gabe.freedesktop.org (Postfix) with ESMTP id 265AA6E1E8 for ; Mon, 5 May 2014 12:53:29 -0700 (PDT) Received: from epcpsbgr3.samsung.com (u143.gpu120.samsung.co.kr [203.254.230.143]) by mailout4.samsung.com (Oracle Communications Messaging Server 7u4-24.01 (7.0.4.24.0) 64bit (built Nov 17 2011)) with ESMTP id <0N54003UD9X3V370@mailout4.samsung.com> for dri-devel@lists.freedesktop.org; Tue, 06 May 2014 04:53:27 +0900 (KST) Received: from epcpsbgm1.samsung.com ( [172.20.52.125]) by epcpsbgr3.samsung.com (EPCPMTA) with SMTP id 42.6C.11120.73CE7635; Tue, 06 May 2014 04:53:27 +0900 (KST) X-AuditID: cbfee68f-b7eff6d000002b70-67-5367ec37f49b Received: from epmmp2 ( [203.254.227.17]) by epcpsbgm1.samsung.com (EPCPMTA) with SMTP id 0A.51.27725.73CE7635; Tue, 06 May 2014 04:53:27 +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 <0N54003FN9WRWO70@mmp2.samsung.com>; Tue, 06 May 2014 04:53:27 +0900 (KST) From: Ajay Kumar To: dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org Subject: [RFC V2 1/3] drm: implement chaining of drm bridges Date: Tue, 06 May 2014 01:22:26 +0530 Message-id: <1399319548-16567-2-git-send-email-ajaykumar.rs@samsung.com> X-Mailer: git-send-email 1.7.9.5 In-reply-to: <1399319548-16567-1-git-send-email-ajaykumar.rs@samsung.com> References: <1399319548-16567-1-git-send-email-ajaykumar.rs@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFmpkkeLIzCtJLcpLzFFi42JZI2JSq2v+Jj3Y4NVUbYsD7w+yWGx4s5DZ 4srX92wWk+5PYLH4vusLu8WM8/uYLFYd3sBu8XzhD2aLuxvOMjpwesxuuMjisXPWXXaP+93H mTz6tqxi9Pi8SS6ANYrLJiU1J7MstUjfLoEr4/7Pa6wF/wQrVt18x9bA+JKvi5GTQ0LAROLC jN3MELaYxIV769m6GLk4hASWMkqc37OKDaZo7cO/LBCJ6YwSHTfms0I4E5gkrncfBKtiE9CW 2Db9JguILSLgJtF0eCZYEbPAekaJlqenmEASwgI2Et+3fQArYhFQlZh3+TiYzSvgIdG9bxF7 FyMH0DoFiTmTbEDCnAKeEudnT2QHsYWASmYu2AI2U0JgHbvE+g3fmSHmCEh8m3yIBaJXVmLT Aah3JCUOrrjBMoFReAEjwypG0dSC5ILipPQiY73ixNzi0rx0veT83E2MwOA//e9Z/w7Guwes DzEmA42byCwlmpwPjJ68knhDYzMjC1MTU2Mjc0sz0oSVxHnvP0wKEhJITyxJzU5NLUgtii8q zUktP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3D+c9YiaU4I9FQ i7moOBEAqe3+4/ECAAA= DLP-Filter: Pass X-MTR: 20000000000000000@CPGS X-CFilter-Loop: Reflected X-Mailman-Approved-At: Tue, 06 May 2014 08:51:19 -0700 Cc: joshi@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 As of now, we can have only one bridge hanging off the encoder. With this patch, we allow multiple bridges to hang onto the same encoder with the use of a simple next_bridge ptr. The drm core calls bridge->funcs for the first bridge which is attached to it, and its upto the individual bridge drivers to call bridge->funcs for the next bridge in the chain. Signed-off-by: Ajay Kumar --- drivers/gpu/drm/drm_crtc.c | 13 ++++++++++++- include/drm/drm_crtc.h | 2 ++ 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/drm_crtc.c b/drivers/gpu/drm/drm_crtc.c index d8b7099..fe9905f 100644 --- a/drivers/gpu/drm/drm_crtc.c +++ b/drivers/gpu/drm/drm_crtc.c @@ -918,8 +918,10 @@ EXPORT_SYMBOL(drm_connector_unplug_all); * Zero on success, error code on failure. */ int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, - const struct drm_bridge_funcs *funcs) + struct drm_encoder *encoder, + const struct drm_bridge_funcs *funcs) { + struct drm_bridge *temp; int ret; drm_modeset_lock_all(dev); @@ -931,6 +933,15 @@ int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, bridge->dev = dev; bridge->funcs = funcs; + if (encoder->bridge) { + temp = encoder->bridge; + while (temp->next_bridge) + temp = temp->next_bridge; + + temp->next_bridge = bridge; + } else + encoder->bridge = bridge; + list_add_tail(&bridge->head, &dev->mode_config.bridge_list); dev->mode_config.num_bridge++; diff --git a/include/drm/drm_crtc.h b/include/drm/drm_crtc.h index e55fccb..bb6ed88 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; @@ -862,6 +863,7 @@ extern void drm_connector_cleanup(struct drm_connector *connector); extern void drm_connector_unplug_all(struct drm_device *dev); extern int drm_bridge_init(struct drm_device *dev, struct drm_bridge *bridge, + struct drm_encoder *encoder, const struct drm_bridge_funcs *funcs); extern void drm_bridge_cleanup(struct drm_bridge *bridge);