From patchwork Fri Dec 10 19:19:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1811 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 61E053F075 for ; Fri, 10 Dec 2021 20:20:05 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id b8-20020a17090a10c800b001a61dff6c9dsf6203495pje.5 for ; Fri, 10 Dec 2021 11:20:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639164004; cv=pass; d=google.com; s=arc-20160816; b=EbLtR+fZkiXDbkZEjE8PEzil0ZnoPElIbxsOCPK5Mme2w4Acla4DZk7U3k4kQj5uYz Vd9QVKMVLBrfLnJ0NOVWqLYueuULMxpoa9gy8G/QVdQPfbmwRLycIYNSVoIAzHDmSx/j rvksLUdjhjlc3i5PMuwt1xTK2Vh/PQizmF+QIV5coAeBJO8T9XF2b0fsPPRL4IwcwDRy NzcGuSLbInl98bOKCpx5sgs/uH4gERLHj8bZd948Gr6pcv8xhEqeyQv4ED/NNyjmLRex 1l3uhv4jMDQ/W6eTJrRvnE7dLrUledpZtZL8qCtmzgWEZnSySkaNhFxo8FdNj0d5pHSX N64g== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=QR6wBdnDMja1A41a+7qG2w4QOwXtGS5rqGj4LTIoU7c=; b=Dg1pQCvs8BqEtm5zrZyfcw+hBVCeNzqkgDHR1IDBx3kB6xceoccABrHXAVrOGV+Jff Om/ORCSqoJmzgl9XmLUo622jhjdfjN0yiXkwdkB5usGhmXy957DdOy6GMwOBBVAXUlu3 wysicBAgLDveVhed9dAy1vu6nv1m+DKNhWm0uoKaRlH/ip+9tNeKxmqb3x2cFp0RRe+T MOax48LFYPF5vJBwWjf5PofswuyJADIAeLOIxtueN3LwGpDFat99GYdGsrWWUsBNvfdM qztL9UThQfqzcA79wRuZ68egikLZdfAUhB6CXGbqRicOhVm6/jhnMt1pC8DmCgFQWujO dchw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cqSBRtko; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=QR6wBdnDMja1A41a+7qG2w4QOwXtGS5rqGj4LTIoU7c=; b=W73yvCXgDffsIKlBW09deCXjHIl+NChGGlsSIb0FN3BIPCroEGPOFH2wEGG8fniOW9 nXMXCubcT1hiVR/mHWEttM1fg3m8rQgbOlClqiGE2RKHoqOgC0bNG7Exx0Vz2X1lZPvu IIQvVNF2M2lLXMWyZt1N0H79VY7rSioLcG2ok= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=QR6wBdnDMja1A41a+7qG2w4QOwXtGS5rqGj4LTIoU7c=; b=Wy0w/mF1eeZpa9rDGG24AnCMlmGwnEQT48iSt+usOgiUtxkh/BeCFmcOH9hZLHe0Di 8hH/s6Kdw/jSrt72jMqK2wNg6z0Ip9Wz9e3gBIym4CEx59/Tmhb1nHl8mJgpSyZf3XMR 8ERpbGG9wb5nsJIq/DUNth/1DETZpmGy79oM8jlBapwNZBqxZ5zTx0ZW3xYMAb/gjzTl 0ZrPaRQsY9VK4fNs6cbReEpny/rNVzI2NeGWxLfBf2pi66C/HHVKJlYcQPnKIajboc22 0t7Bbk0PaB6/gX5RIXw4J/V3zz0Dr9tjnpV2KJ7yqrQfuSi4k7anx0UlUfrksRsd5C1T nUtg== X-Gm-Message-State: AOAM533TY5QYDziEeaZdDdP3GsSZoGZVGrmfc3UwC8zKeKR2OsUguuha KTgbBfmMFLGDvhSr6H4fZrRmthr6 X-Google-Smtp-Source: ABdhPJwPTAuMsa/9YcYFAnwU9YpfnR1vuAQgFD9Ax0mgsK468wKgmNjpKOMIBDmUE4gWv5sbJem0/w== X-Received: by 2002:a17:90a:5e06:: with SMTP id w6mr2035927pjf.228.1639164003833; Fri, 10 Dec 2021 11:20:03 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e5d0:: with SMTP id u16ls5303999plf.0.gmail; Fri, 10 Dec 2021 11:20:03 -0800 (PST) X-Received: by 2002:a17:90b:1b52:: with SMTP id nv18mr26536607pjb.43.1639164003156; Fri, 10 Dec 2021 11:20:03 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639164003; cv=none; d=google.com; s=arc-20160816; b=xZSMtZbF8wpfhrpCmVH9mpeVOGzCQlcm+9cIbkP8u89lgM12PDa1gcN34AbWYd7GCF P/QR2SaNAi7WJF3bgzBnvJ0t56I8lbIpCUkwzgIFwAA+NcaLSPdMj2eGLPj0Rcpxj/7F ou5TLoudn+hFGzMmRw/Qe9Naa0c9jMURM8BokGRdjJ2n7DlvOBQEDHlLhqHVBvmkoNn6 94Ci3oGGCcLUS8c9emobHXOjP4uy9ndGzM4S5I4Fuo4rhpyUpS1j/FzXYdU3MIcIluDT GAYZfKYOZPNDHu1o6+0eyMVku+jUh+xVioLT4bRfytwnEl78PduDAnOjWKGCiDxrPAuO lIjQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=wZ823IYdWVSXlqlfCjZXc9dDMONl8prYaLH+tdv9C84=; b=c7Xq/RZIfKjPwslntYH2PEL/PI1K4KRz3taX25uROV+O0svGUVBbUDlCx0rG1wd5I1 Z+LR6Mk/GpuVPsLGuVKHZ/W2NhYuId2T8tG3D4vlmz50Eb1soIn2S46T7vWj/PrkCdYT PDBJbcQGSHdRvHNkcK0/NIRcRgqY/JsRAXFbXdVBWu/yESL3TlTnpkuvAGiy2Jrvz+aW gLlAyA7WfvtgzJUkPLQXVdjy7hAwSMkjye/oAtSZvw5NkhTv5i0FnarNsQonV6hAe2c+ Fji+gvJs5CGWEM9W+ChJKit7H+AitPNJ+Yuu1tTm+7XxFKgAIwapa3XJPwpG+m+LiTXT xWFw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cqSBRtko; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id ob11sor3206583pjb.37.2021.12.10.11.20.03 for (Google Transport Security); Fri, 10 Dec 2021 11:20:03 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:1947:: with SMTP id nk7mr26414009pjb.227.1639164002862; Fri, 10 Dec 2021 11:20:02 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:28d6:2bae:633e:b110]) by smtp.gmail.com with ESMTPSA id o62sm3493022pfb.211.2021.12.10.11.19.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 11:20:02 -0800 (PST) From: Jagan Teki To: Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg , Michael Nazzareno Trimarchi , Inki Dae Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 1/4] drm: exynos: dsi: Check panel for panel helpers Date: Sat, 11 Dec 2021 00:49:19 +0530 Message-Id: <20211210191922.2367979-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210191922.2367979-1-jagan@amarulasolutions.com> References: <20211210191922.2367979-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cqSBRtko; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Trigger the panel operation helpers only if host found the panel. Add check. Signed-off-by: Jagan Teki --- Changes for v2: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 8d137857818c..0bb44e476633 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1439,7 +1439,8 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - drm_panel_disable(dsi->panel); + if (dsi->panel) + drm_panel_disable(dsi->panel); list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->disable) @@ -1447,7 +1448,8 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) } exynos_dsi_set_display_enable(dsi, false); - drm_panel_unprepare(dsi->panel); + if (dsi->panel) + drm_panel_unprepare(dsi->panel); list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->post_disable) From patchwork Fri Dec 10 19:19:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1812 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 505183F075 for ; Fri, 10 Dec 2021 20:20:16 +0100 (CET) Received: by mail-pg1-f198.google.com with SMTP id j3-20020a634a43000000b00325af3ab5f0sf5656351pgl.11 for ; Fri, 10 Dec 2021 11:20:16 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639164014; cv=pass; d=google.com; s=arc-20160816; b=orz2oTOvYfT2S6BWiVrwHK/7nITSqGEFCwBkrToQuW6FEwDTxGCqWgSDLNKNcslqWd uhiCyFrTjbA+53EC4sTilkNeNGHPEHm2c/k8rILNfkeYmWbtY1RVWDMHOv2JAlOGHOij MWS4vGUcaVWYMyyGq/CNKAb1egZhzkAO4BYj3xjlK8MzPDPcqGt9d+EYO5IrjQiMH5b9 qcE9B8ey8vto4kfGb43egiGpODKnsYyCDrEpfuT59igdrytX6oLQc1argdAQEHi+PO6r QnaC1NYL5TcSXwuuLjYOeTUP+Fv75NXc5NCSmgvHu1vTT/4AQ6bakSgFOlqYiP4hf+Z7 ommA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=ldQJqYcJuvQfd7gQQDG8Dle5n8FO3Zn+0Iqeda7YJpk=; b=lNxFsYNavU0YXv3BwcOoqpDivQ6ThlaV6Hc7kde1V5BUvFR6ivb65TR3fLPyOEdQny 9V1Dy/A+wlli+GecxGCr66kw3CyhpRpzTBAttN/5XHDBtRECnLewBLBxwGjcU+rJrN3o Hsse/3M1erNHRV8TmafXGS8uTelWIq8zjuXilUp0Zzapw4XE39+TjFyKO8eDoAopW6aw M0TrroMEPcETo9gfrxgqHDL1XfH95cakKerCV9BwmKXEImJF1/rw+tSTxsDcTYTFByqG eX2MPuBIRnIjdSEERPxwe+ZGLlaOFvYaU54ekoPzx5RJrjB0xuvq7fAP8gUjZk4kAmjE Pe/w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mNAfy4UD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=ldQJqYcJuvQfd7gQQDG8Dle5n8FO3Zn+0Iqeda7YJpk=; b=HGkoUMlXBmf+k1+E0fn4h8v5WxbVU3ISm1FcszlaQBCcAjMRHAI5xzBB/Z352uPS4G 4gIA4PPwY0udiL3CC2E9pSYRRtyxyaleARhcpQIG1snYK/keeohIMmLYQ2kaDfnhFsmj 8ysVcpAm61jkOpKfYGbRXYUSOmTNOQ9cn9O9E= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=ldQJqYcJuvQfd7gQQDG8Dle5n8FO3Zn+0Iqeda7YJpk=; b=5hdN0jW+3xNQBW/U5sGDitr0AHP/dJkrz63vlEFuRacbmbgNp+arMpz6z+IhyscERS Y6Rp1MpuGpl3P8HulERfFT/CDbAvF0IZkraQw2Y/WxyXdWfWjwUbNVrZtNX1C/sQDwMA im+zyzIsuro/tDjOAWOZB5XXj9fipuKQtbHSGa7k9QhWZ6pVUD/HTrGb9qEgxUxy+u62 ae7hC490orVo6IrUko0UGrSxzGxKk+faNcbuWk51pgq/I+3C8VbK64XGWKSYwtMISukA FkQyGkm95LiVd6aYBTqIbp4ghzAiXWXndAKnDy3ENMSqum+HIDlBuxR223aA6v/hHDjo am+Q== X-Gm-Message-State: AOAM530Q0RCWN3rvu18PPMKM1IlJcZCPNsVQwB5JAtdfGWKkCJy/lfKy OMradWwFvzIHLQbhTARhaCqqXPzs X-Google-Smtp-Source: ABdhPJxIc+IMVNCV0pyi9WbSAixVANg78oNJpWoeCRUTNPM/+mJ5DSZTqVS4bLCHDjkCG/HPdWXjLw== X-Received: by 2002:aa7:9143:0:b0:4ac:bc9a:1074 with SMTP id 3-20020aa79143000000b004acbc9a1074mr20082562pfi.38.1639164014679; Fri, 10 Dec 2021 11:20:14 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:903:1c2:: with SMTP id e2ls5288367plh.9.gmail; Fri, 10 Dec 2021 11:20:14 -0800 (PST) X-Received: by 2002:a17:902:9a4a:b0:146:8ce2:672 with SMTP id x10-20020a1709029a4a00b001468ce20672mr32857274plv.29.1639164013920; Fri, 10 Dec 2021 11:20:13 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639164013; cv=none; d=google.com; s=arc-20160816; b=BEQWRzYVxgKKa3yYEauMx5bZ3CjrsPQRRClA6b2Jm2AGpWgCw+8yFbNV0Yus8JNJ7/ 4u7QUOskYZ0eUm9i47+XpA8kd9hw3dWDyMc14fjq5JznCy2RHJZMRtC+G0klYg1sixnu 2x7LjSTvVqmivAWpCxs9QhF4Y1E0ojuG2gCZOhgcKtquqqkKYjQeWaYGbz9/0OS/FXXS uuMSCPRYjtQ7d4YqtFJUCNqDUsvhFpnjgzRKdz7H1LQW9uDZyI3AeFqXiJMq9P1BYSo5 8m/+8wgWWPMAtyBGb77QTM1Y3ORU5bL0MgaQT1xPNw/Vu3wVCIHGHTIW5R9Ug0og4YwJ UhTA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=u+8J0typzXJBP9SmIdZ7aUHRk1S8ZG0rEGDpl9ZWmlI=; b=lZq7C0QMvHUUvVpHV2/uBH6UPNQsqRJkYhH1iMquPms4qBVvuMfc/ySM1u2LiQ6gLr rZt18KR3qQB6lY8gdt7/wlqTwNaO63iI1X709N++O7h53J+h43qC1URClgHR5yVv7M83 ZdpdGZHz+sYKtBlZSBS5u6RWz/nEmVbJ8mg83RJMB/aOCWcxU++DVL5s/yR7YWuYjeIM MelnJZoDoVtLesw9UegI52aCMK+V905XlxPLwy2eII21atLxQ0Ig/OPSqLjtexm9mD4x C9HldPtXzDi6LC7p3MJwHYGUh1hoG2A+cbR1cUhackWUnSZooBkhvS/7rnbL5NKnOUuk iJxg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mNAfy4UD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id i12sor3142281plb.60.2021.12.10.11.20.13 for (Google Transport Security); Fri, 10 Dec 2021 11:20:13 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:902:ce8c:b0:141:d218:954 with SMTP id f12-20020a170902ce8c00b00141d2180954mr76943327plg.1.1639164013383; Fri, 10 Dec 2021 11:20:13 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:28d6:2bae:633e:b110]) by smtp.gmail.com with ESMTPSA id o62sm3493022pfb.211.2021.12.10.11.20.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 11:20:12 -0800 (PST) From: Jagan Teki To: Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg , Michael Nazzareno Trimarchi , Inki Dae Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 2/4] drm: exynos: dsi: Use drm panel_bridge API Date: Sat, 11 Dec 2021 00:49:20 +0530 Message-Id: <20211210191922.2367979-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210191922.2367979-1-jagan@amarulasolutions.com> References: <20211210191922.2367979-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mNAfy4UD; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Replace the manual panel handling code by a drm panel_bridge via devm_drm_of_get_bridge(). Adding panel_bridge handling, - Drops drm_connector and related operations as drm_bridge_attach creates connector during attachment. - Drops panel pointer and iterate the bridge, so-that it can operate the normal bridge and panel_bridge in constitutive callbacks. This simplifies the driver and allows all components in the display pipeline to be treated as bridges. Signed-off-by: Jagan Teki --- Changes for v2: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 147 +++--------------------- 1 file changed, 14 insertions(+), 133 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 0bb44e476633..8c6f7ac82822 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,8 +254,6 @@ struct exynos_dsi_driver_data { struct exynos_dsi { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; - struct drm_connector connector; - struct drm_panel *panel; struct list_head bridge_chain; struct drm_bridge *out_bridge; struct device *dev; @@ -285,7 +283,6 @@ struct exynos_dsi { }; #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) -#define connector_to_dsi(c) container_of(c, struct exynos_dsi, connector) static inline struct exynos_dsi *encoder_to_dsi(struct drm_encoder *e) { @@ -1391,42 +1388,21 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) dsi->state |= DSIM_STATE_ENABLED; - if (dsi->panel) { - ret = drm_panel_prepare(dsi->panel); - if (ret < 0) - goto err_put_sync; - } else { - list_for_each_entry_reverse(iter, &dsi->bridge_chain, - chain_node) { - if (iter->funcs->pre_enable) - iter->funcs->pre_enable(iter); - } + list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { + if (iter->funcs->pre_enable) + iter->funcs->pre_enable(iter); } exynos_dsi_set_display_mode(dsi); exynos_dsi_set_display_enable(dsi, true); - if (dsi->panel) { - ret = drm_panel_enable(dsi->panel); - if (ret < 0) - goto err_display_disable; - } else { - list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->enable) - iter->funcs->enable(iter); - } + list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { + if (iter->funcs->enable) + iter->funcs->enable(iter); } dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; return; - -err_display_disable: - exynos_dsi_set_display_enable(dsi, false); - drm_panel_unprepare(dsi->panel); - -err_put_sync: - dsi->state &= ~DSIM_STATE_ENABLED; - pm_runtime_put(dsi->dev); } static void exynos_dsi_disable(struct drm_encoder *encoder) @@ -1439,17 +1415,12 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - if (dsi->panel) - drm_panel_disable(dsi->panel); - list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->disable) iter->funcs->disable(iter); } exynos_dsi_set_display_enable(dsi, false); - if (dsi->panel) - drm_panel_unprepare(dsi->panel); list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->post_disable) @@ -1460,70 +1431,6 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) pm_runtime_put_sync(dsi->dev); } -static enum drm_connector_status -exynos_dsi_detect(struct drm_connector *connector, bool force) -{ - return connector->status; -} - -static void exynos_dsi_connector_destroy(struct drm_connector *connector) -{ - drm_connector_unregister(connector); - drm_connector_cleanup(connector); - connector->dev = NULL; -} - -static const struct drm_connector_funcs exynos_dsi_connector_funcs = { - .detect = exynos_dsi_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = exynos_dsi_connector_destroy, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - -static int exynos_dsi_get_modes(struct drm_connector *connector) -{ - struct exynos_dsi *dsi = connector_to_dsi(connector); - - if (dsi->panel) - return drm_panel_get_modes(dsi->panel, connector); - - return 0; -} - -static const struct drm_connector_helper_funcs exynos_dsi_connector_helper_funcs = { - .get_modes = exynos_dsi_get_modes, -}; - -static int exynos_dsi_create_connector(struct drm_encoder *encoder) -{ - struct exynos_dsi *dsi = encoder_to_dsi(encoder); - struct drm_connector *connector = &dsi->connector; - struct drm_device *drm = encoder->dev; - int ret; - - connector->polled = DRM_CONNECTOR_POLL_HPD; - - ret = drm_connector_init(drm, connector, &exynos_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); - if (ret) { - DRM_DEV_ERROR(dsi->dev, - "Failed to initialize connector with drm\n"); - return ret; - } - - connector->status = connector_status_disconnected; - drm_connector_helper_add(connector, &exynos_dsi_connector_helper_funcs); - drm_connector_attach_encoder(connector, encoder); - if (!drm->registered) - return 0; - - connector->funcs->reset(connector); - drm_connector_register(connector); - return 0; -} - static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { .enable = exynos_dsi_enable, .disable = exynos_dsi_disable, @@ -1537,30 +1444,13 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct exynos_dsi *dsi = host_to_dsi(host); struct drm_encoder *encoder = &dsi->encoder; struct drm_device *drm = encoder->dev; - struct drm_bridge *out_bridge; - out_bridge = of_drm_find_bridge(device->dev.of_node); - if (out_bridge) { - drm_bridge_attach(encoder, out_bridge, NULL, 0); - dsi->out_bridge = out_bridge; - list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); - } else { - int ret = exynos_dsi_create_connector(encoder); - - if (ret) { - DRM_DEV_ERROR(dsi->dev, - "failed to create connector ret = %d\n", - ret); - drm_encoder_cleanup(encoder); - return ret; - } + dsi->out_bridge = devm_drm_of_get_bridge(dsi->dev, dsi->dev->of_node, 0, 0); + if (IS_ERR(dsi->out_bridge)) + return PTR_ERR(dsi->out_bridge); - dsi->panel = of_drm_find_panel(device->dev.of_node); - if (IS_ERR(dsi->panel)) - dsi->panel = NULL; - else - dsi->connector.status = connector_status_connected; - } + drm_bridge_attach(encoder, dsi->out_bridge, NULL, 0); + list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); /* * This is a temporary solution and should be made by more generic way. @@ -1596,18 +1486,9 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, struct exynos_dsi *dsi = host_to_dsi(host); struct drm_device *drm = dsi->encoder.dev; - if (dsi->panel) { - mutex_lock(&drm->mode_config.mutex); - exynos_dsi_disable(&dsi->encoder); - dsi->panel = NULL; - dsi->connector.status = connector_status_disconnected; - mutex_unlock(&drm->mode_config.mutex); - } else { - if (dsi->out_bridge->funcs->detach) - dsi->out_bridge->funcs->detach(dsi->out_bridge); - dsi->out_bridge = NULL; - INIT_LIST_HEAD(&dsi->bridge_chain); - } + if (dsi->out_bridge->funcs->detach) + dsi->out_bridge->funcs->detach(dsi->out_bridge); + INIT_LIST_HEAD(&dsi->bridge_chain); if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); From patchwork Fri Dec 10 19:19:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1813 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4B49C3F075 for ; Fri, 10 Dec 2021 20:20:35 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id s18-20020a63ff52000000b00320f169c0aasf5645170pgk.18 for ; Fri, 10 Dec 2021 11:20:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639164034; cv=pass; d=google.com; s=arc-20160816; b=x5Vu8AR1SlBXYREy4yTBxCJq1PYPlluTcOflEyoISL8/Q9T2/a+EHAU3KE7cRzGWp1 Y+ZmldOG43rhkNU8ba1WLBC6yhlaEgeUgd0ef3tkwSCzlyz4bekBXmV9yslpAyQzg4dv wYIYeV/synm3ZGrXs9T4vtxYHnxCVbWgZNTduZRkQJnQj6iMuZ4dd4q+KLZ1KU6pOuSD RvjJvIPZfu0K4207t/45uVgv4kCkAXwQoIb44DDVtUdsssoHvh9iAxw40UAAXoR2h96T sNa0TqaDfeIlS4NP1nR4cFrjZvCW4EOrLzAPHq8UOauO2baiegc9c+NXXKjWT+z13Dqg yTKw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Sx/e6IoGKA66UMf04qFwQjPiVCqaddbrkCS6cQ9RxOU=; b=u36LeZRLFjr/G1OZ9UseqCBS03noEBUyZAT2P1PhJr93yv2c6jeThz7qf38adciEl5 JBtA6NtGJ1jwn9wQ1srUp6GgPNxAQs37+h9d0+SxY6MJGYJSKpdLAl6aY/fw5htL96lz IYytG9vz9tWHD8kJVtkHKjWk6R6YLW9y0XMXXe87GH0wGm9hekvlQ8UpOp8Sdmgyj5eF WgkunyJi+LalrWM/TYaGjdcjX0Wb02Ojg/YBaBQKyTv7msaoM7s8+a7jEF6WN8u+nkaN VxJseElYNZw1a/iMzb2fIDWjUHV4e4tDdJQMF1kds7HWbI9UVxsOEDxIlXe4hTY7mQ/T 86fA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=n3Doa08l; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Sx/e6IoGKA66UMf04qFwQjPiVCqaddbrkCS6cQ9RxOU=; b=HxmwpHs832Z4ukWxhO2Dt/zlBJrNtKGigSaNwfMXh56BKBy4mFRhuFp03oBlZLZwsB GqLgR8zTzzgKFjGn4/0bQePrpaVkV26wJoEeyEtf+lpfXiKXP4Mg1uj7fuh0UcUOUdLH dKSddlKPI7LcwaBn+Ffu0XQ4il+twcd5pFit0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Sx/e6IoGKA66UMf04qFwQjPiVCqaddbrkCS6cQ9RxOU=; b=I9Tidu/V1KzY1pOBda3PraEUQuYeAyHsbS/GfhhW5TG92JyI0QBQCfvNXGS5YPUK1a Bj4m/VTSyFDLo6h1c7Yh7iS1EkTE189SUGVAIFJeTPirJ6ECX56wQ2+MCVTPC/2BwGXU 5/qM5L0s4TMuWczb4ESam8+DDCInhM2DOhSSi0fBEmH3bgvGO6LDrqf1JZYuvpgQ+EB/ 3f6NAQyunrdYluz8/bjXzUmqYXoDTA8p2njV7jyI3KqJhxc8vx3pbCi2oLiYX2SwxhMt jwR/WqmqBKnEUpHlePwi8PndF07DIMXtWIewUTikB8WZDb0u8E7a+fmUV870nn5VYKhB hJGw== X-Gm-Message-State: AOAM530aVv7qvJ+HzAbYghQGg4okCyhJ/N6s2Ytigu0pxMUMYDSEuXPc /34r43xVJAIWLDQ7AVVvkfbO+6C+ X-Google-Smtp-Source: ABdhPJyC2BtIC2QwscHqs9S0Jxo4Kn7IlKNg2G3memSz1i4hsB+v8noebseO5VQ3UGFACmnaWdJL5g== X-Received: by 2002:a17:90b:3ecd:: with SMTP id rm13mr25667993pjb.157.1639164034009; Fri, 10 Dec 2021 11:20:34 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:18a9:: with SMTP id x41ls3672846pfh.0.gmail; Fri, 10 Dec 2021 11:20:33 -0800 (PST) X-Received: by 2002:a63:5906:: with SMTP id n6mr39545780pgb.563.1639164033245; Fri, 10 Dec 2021 11:20:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639164033; cv=none; d=google.com; s=arc-20160816; b=S6cTn0EPXCyzwcZsv6B+kE59Si8zRtVvdLTo+XtOQeVcphK60i0fABfoXkTXc0sJur z/acvMQ2Ixu4ZV7g31qJsEH/gymjB8GOwjKaMV4jQmmhq2VnfIX7UOjsZTEunFDrloDe KI4UpS/ldCzlpX9kK3CT6yBpJXnOamaNrqppL7z4CvocIAWnlB81loxyeJhHqu7CZoEc apMYfYSYLattmLlrlybuRo6xOPl+FMM5VamYEMrBtW3KO/pGuiaig//cbgjWNhoAeqsQ K+LwYh4fC6R9BWzc9B/kgvP1/1d7ICMrDBcpylc8EQzg1aK0wYxFNJQHNbkWUQkVRfXb PeIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=+LaYYqalTE0PFqsd8qC0JzK3G3SgXuhMj6ny3iea3fQ=; b=H1/B9mkURCbiMj8ztOoCzrylm2dxisks0IW18u1Us+j8m05yL68+bR5C62vqeh4+Eo W6V6b158ZvqCkR9IEXKGCPhpDa+uUi1Qak4GUfUfyTL/kj2isaos0INppYPd50zAou60 Z+3vf/VFzgEtRySkdEb73pc8xmEFpqMkkgmA6lCPYIwW9gZXdN8jtwaGofCchXAqH1IB N2WkeAYYbvAfoh5l6bRyT8mquSgKDvjrKxwSafDg8oshvxv99qwRn2snmkxmkjY3qJF8 AIh99Kj839XmOFH48igQDhdBBUC7kjMNwiGgiswf+eDAT7i2oCzBw8tbA83Ad/LzwqM4 2wmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=n3Doa08l; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id v1sor10128801pjd.18.2021.12.10.11.20.33 for (Google Transport Security); Fri, 10 Dec 2021 11:20:33 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90a:ff03:: with SMTP id ce3mr26106350pjb.89.1639164032951; Fri, 10 Dec 2021 11:20:32 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:28d6:2bae:633e:b110]) by smtp.gmail.com with ESMTPSA id o62sm3493022pfb.211.2021.12.10.11.20.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 11:20:32 -0800 (PST) From: Jagan Teki To: Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg , Michael Nazzareno Trimarchi , Inki Dae Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 3/4] drm: exynos: dsi: Convert to bridge driver Date: Sat, 11 Dec 2021 00:49:21 +0530 Message-Id: <20211210191922.2367979-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210191922.2367979-1-jagan@amarulasolutions.com> References: <20211210191922.2367979-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=n3Doa08l; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Convert the encoders to bridge drivers in order to standardize on a single API with built-in dumb encoder support for compatibility with existing component drivers. Driver bridge conversion will help to reuse the same bridge on different platforms as exynos dsi driver can be used as a Samsung DSIM and use it for i.MX8MM platform. Bridge conversion, - Drops drm_encoder_helper_funcs, bridge_chain. - Adds drm_bridge_funcs and register a drm bridge. Convert it. Signed-off-by: Jagan Teki --- Changes for v2: - drop bridge_chain drivers/gpu/drm/exynos/exynos_drm_dsi.c | 84 +++++++++++++------------ 1 file changed, 45 insertions(+), 39 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 8c6f7ac82822..37ad94b563c4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,7 +254,7 @@ struct exynos_dsi_driver_data { struct exynos_dsi { struct drm_encoder encoder; struct mipi_dsi_host dsi_host; - struct list_head bridge_chain; + struct drm_bridge bridge; struct drm_bridge *out_bridge; struct device *dev; @@ -284,9 +284,9 @@ struct exynos_dsi { #define host_to_dsi(host) container_of(host, struct exynos_dsi, dsi_host) -static inline struct exynos_dsi *encoder_to_dsi(struct drm_encoder *e) +static inline struct exynos_dsi *bridge_to_dsi(struct drm_bridge *b) { - return container_of(e, struct exynos_dsi, encoder); + return container_of(b, struct exynos_dsi, bridge); } enum reg_idx { @@ -877,9 +877,10 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) return 0; } -static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) +static void exynos_dsi_set_display_mode(struct drm_bridge *bridge) { - struct drm_display_mode *m = &dsi->encoder.crtc->state->adjusted_mode; + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + struct drm_display_mode *m = &bridge->encoder->crtc->state->adjusted_mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; u32 reg; @@ -1371,10 +1372,10 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_enable(struct drm_encoder *encoder) +static void exynos_dsi_enable(struct drm_bridge *bridge) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); - struct drm_bridge *iter; + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + const struct drm_bridge_funcs *funcs = dsi->out_bridge->funcs; int ret; if (dsi->state & DSIM_STATE_ENABLED) @@ -1388,52 +1389,53 @@ static void exynos_dsi_enable(struct drm_encoder *encoder) dsi->state |= DSIM_STATE_ENABLED; - list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->pre_enable) - iter->funcs->pre_enable(iter); - } + if (dsi->out_bridge) + funcs->pre_enable(dsi->out_bridge); - exynos_dsi_set_display_mode(dsi); + exynos_dsi_set_display_mode(bridge); exynos_dsi_set_display_enable(dsi, true); - list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->enable) - iter->funcs->enable(iter); - } + if (dsi->out_bridge) + funcs->enable(dsi->out_bridge); dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; return; } -static void exynos_dsi_disable(struct drm_encoder *encoder) +static void exynos_dsi_disable(struct drm_bridge *bridge) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); - struct drm_bridge *iter; + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + const struct drm_bridge_funcs *funcs = dsi->out_bridge->funcs; if (!(dsi->state & DSIM_STATE_ENABLED)) return; dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - list_for_each_entry_reverse(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->disable) - iter->funcs->disable(iter); - } + if (dsi->out_bridge) + funcs->disable(dsi->out_bridge); exynos_dsi_set_display_enable(dsi, false); - list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { - if (iter->funcs->post_disable) - iter->funcs->post_disable(iter); - } + if (dsi->out_bridge) + funcs->post_disable(dsi->out_bridge); dsi->state &= ~DSIM_STATE_ENABLED; pm_runtime_put_sync(dsi->dev); } -static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, +static int exynos_dsi_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, NULL, 0); +} + +static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { + .enable = exynos_dsi_enable, + .disable = exynos_dsi_disable, + .attach = exynos_dsi_attach, }; MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); @@ -1449,8 +1451,7 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, if (IS_ERR(dsi->out_bridge)) return PTR_ERR(dsi->out_bridge); - drm_bridge_attach(encoder, dsi->out_bridge, NULL, 0); - list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); + drm_bridge_attach(encoder, &dsi->bridge, NULL, 0); /* * This is a temporary solution and should be made by more generic way. @@ -1488,7 +1489,6 @@ static int exynos_dsi_host_detach(struct mipi_dsi_host *host, if (dsi->out_bridge->funcs->detach) dsi->out_bridge->funcs->detach(dsi->out_bridge); - INIT_LIST_HEAD(&dsi->bridge_chain); if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); @@ -1585,8 +1585,6 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); - drm_encoder_helper_add(encoder, &exynos_dsi_encoder_helper_funcs); - ret = exynos_drm_set_possible_crtcs(encoder, EXYNOS_DISPLAY_TYPE_LCD); if (ret < 0) return ret; @@ -1606,9 +1604,8 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master, void *data) { struct exynos_dsi *dsi = dev_get_drvdata(dev); - struct drm_encoder *encoder = &dsi->encoder; - exynos_dsi_disable(encoder); + exynos_dsi_disable(&dsi->bridge); mipi_dsi_host_unregister(&dsi->dsi_host); } @@ -1634,7 +1631,6 @@ static int exynos_dsi_probe(struct platform_device *pdev) init_completion(&dsi->completed); spin_lock_init(&dsi->transfer_lock); INIT_LIST_HEAD(&dsi->transfer_list); - INIT_LIST_HEAD(&dsi->bridge_chain); dsi->dsi_host.ops = &exynos_dsi_ops; dsi->dsi_host.dev = dev; @@ -1702,6 +1698,12 @@ static int exynos_dsi_probe(struct platform_device *pdev) pm_runtime_enable(dev); + dsi->bridge.funcs = &exynos_dsi_bridge_funcs; + dsi->bridge.of_node = dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; + + drm_bridge_add(&dsi->bridge); + ret = component_add(dev, &exynos_dsi_component_ops); if (ret) goto err_disable_runtime; @@ -1716,6 +1718,10 @@ static int exynos_dsi_probe(struct platform_device *pdev) static int exynos_dsi_remove(struct platform_device *pdev) { + struct exynos_dsi *dsi = platform_get_drvdata(pdev); + + drm_bridge_remove(&dsi->bridge); + pm_runtime_disable(&pdev->dev); component_del(&pdev->dev, &exynos_dsi_component_ops); From patchwork Fri Dec 10 19:19:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1814 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id D2DE33F075 for ; Fri, 10 Dec 2021 20:20:47 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id x6-20020a17090a6c0600b001a724a5696csf6488924pjj.6 for ; Fri, 10 Dec 2021 11:20:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639164046; cv=pass; d=google.com; s=arc-20160816; b=ZgVh1Gb4+RHAW46EH1AGdJjTISoZcvUwYkvT8o/4mCA06ZTLCS58lKN8f0BhlpBnn5 XN6uqqpS1Rf9chpaJ/BwJmb1AqPl3d97ahJm2pQqbbdT/61PxGvWRdi+xlw+7lbHk7wq yP9mdYSgd5rODKPz5lS/ErFiNE+wijvRmXVAVWVNL2m4R9eifyiRiKKNgFMwTZYTA38D Rpg3IxY/QtaDp43EFTUyWNcauTj1I4sqIsFKFKax+1GwRaZJw9YjBe0WJfLHhNBgkc4L g0rrQy0uFHlW2t6vUg1sxa0Kt6pWyzy6BV269gNBmH+SYsehnvEaOryRVcRqY7zQiOI1 RfZw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=BFr6VbpRqKwSnZ73v1bEeuZPZ9jASDX0j6VMiNi+tSs=; b=AyyxyP8X+Sm1D2z7Quhtv3gLE8Oqf5VsA5aWp9iltGK3pwuqm95rKclwltIn1t6joz ot9m09MFpHAG+PRTxAYnZRrbUI6j8qFYCj7YDRRFUPJwROKbHHZaMSeVVXBLoZOWLyK2 bidHgUkE5hlnZET7oUtTfWnpaA4D5OsKdSk/RoO1zjI1vJTOvfi2HCYPsbNS5nh2FXeO PVG9CqR9f+Vyys67nHGUd7zWmkXVDgdr/ULFMaI+p9iKr1v+4iD3j4ODV0ObpCYErx9y Z5Pp0YY7Z66RUDuI15citiXTRk44UGrF9CxCnIp6KUAerowervTDK7vnUg1DUd7c8s3D Ssbg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y+rDwOdM; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=BFr6VbpRqKwSnZ73v1bEeuZPZ9jASDX0j6VMiNi+tSs=; b=nh+7YHaqBysghHmcN9dj11YKLdJYE0As6t2AJg0QJXWbRrnh2rVg9pZNUkYTLW1saK FeZLo6CEkpWPIhDCPAOpVndqmLXuIjQXVkr4YK85lZim9ajmZM0xK9OVQ6VLlxyNn5l5 FlRmF7X1ha1eFOrwqIDaTzoivOlrBncHZv8tM= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=BFr6VbpRqKwSnZ73v1bEeuZPZ9jASDX0j6VMiNi+tSs=; b=WH+LZ1wL3aItnEPFZ4ZdLWJ2RmR+7JriVZumqty2s7LUqGf5jg1asIOknb3YwR7w7O PEUcmY7oCvWMVhQoZh5cZfZ+BAK2z7zmp9MRX1cdK968BWP/I9kdfzVawkha8uh6RKqA SlrbYwpvnxAetuMgWZEnrrMM6TM+FyHFM/zfcgAmFumvLbZhE283uF9LHIDiXO/foURl 7FcZ6am/voOeawS72ctP7Vt1L9P+AxoKfGjZcsqXWm9iLxvN7MhX9WDToc+iW/9+AZfC 0mdsenevZpv8uss3YaDo2XH2mNjvfrB/e4shHRKa2QYbGacnPVqsUiHKQwwDSN4x7l8f AJLw== X-Gm-Message-State: AOAM531rSl6Y1mZ5a6nJuEMxsmQ2vT6cqVPdgAJNxrcxcRvDt7gGYTS1 WAxH0ycDd1Ez7CXYltoeaWWpNHkc X-Google-Smtp-Source: ABdhPJyXO3lrPSqrl23d8jVMLlKbhgDwlG19WrEEaNwWJqqTJ1rXqe1kwzuBKrDWq8EDxUGSVuhHng== X-Received: by 2002:a17:90a:bb84:: with SMTP id v4mr26485887pjr.4.1639164046651; Fri, 10 Dec 2021 11:20:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:7152:: with SMTP id b18ls2967934pgn.7.gmail; Fri, 10 Dec 2021 11:20:46 -0800 (PST) X-Received: by 2002:a63:161f:: with SMTP id w31mr20341558pgl.14.1639164045945; Fri, 10 Dec 2021 11:20:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639164045; cv=none; d=google.com; s=arc-20160816; b=aA6BZr7w0I/H70YtJKU9yF0eSAuU+go2RbPn8K3z3Wqaxsvk+SNzblgVeyxABIzM32 SpuT/VUTRk8dK2cLLfrK1q8plKX16wEKSNoLUFuXOEL4TutaYZBOCpdYdJgc4NLH5WJk 5kkKrf6irz4UPK7QOq530xe+KCSIOn6qIoQiDoIHAjv+172sOEniMs0n4UwueB362wam TX/THWmACqGOKz7VxIpAxWsdIXMljvmvgMRo5kibok30dAa7SlbchcRvdgr5xI2cakyP aBe7oi4OSlIAWp+KrXxXNaXQYfJyIXgK6a/TIgu3094b4nnLEK7xBySwpN1N/13qOgz0 Mb0w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=LJL7M/YkR4k8VZB5K5AMyhwtJ9pwnvBOZ1XLM0mNSl0=; b=ZZoj1+bNyUs5b5RM/pji62ktxWuBURHJH1ywq54ZLmtDkGfgb5jwPD3w0hZ9mBryV0 JGoYuToRGG7KEwFGJP5ECqroHGWmPxkWShsTS7yUsY8/CBgfuTxdR8Z6aL0kb/KRIRbw LNYR0910E4BFu2ei4sg7wy35M59r/c/mAs0nrSQBB8a6orXd9i9PQH6EX6IWoBAWvoqF Ofw/U/E/zaJOSFExvW3L5yyct62ud+09SrHdY+l9YIqWAEP6u6a0I54RDk7Qn2Qm1IDt z+ClAI2EBjRbOYJ2KCnvFGUySuIHnzMtWXbemyOi2NyjsXZXP+Ye0WeSWxiDPTEHooFi BpAA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y+rDwOdM; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id b1sor2372606pgh.79.2021.12.10.11.20.45 for (Google Transport Security); Fri, 10 Dec 2021 11:20:45 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a63:4f42:: with SMTP id p2mr41362855pgl.381.1639164045711; Fri, 10 Dec 2021 11:20:45 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:28d6:2bae:633e:b110]) by smtp.gmail.com with ESMTPSA id o62sm3493022pfb.211.2021.12.10.11.20.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 11:20:45 -0800 (PST) From: Jagan Teki To: Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg , Michael Nazzareno Trimarchi , Inki Dae Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v2 4/4] drm: exynos: dsi: Switch to atomic funcs Date: Sat, 11 Dec 2021 00:49:22 +0530 Message-Id: <20211210191922.2367979-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210191922.2367979-1-jagan@amarulasolutions.com> References: <20211210191922.2367979-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y+rDwOdM; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , The new support drm bridges are moving towards atomic functions. Replace atomic version of functions to continue the transition to the atomic API. Signed-off-by: Jagan Teki --- Changes for v2: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 37ad94b563c4..f2c12a356952 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1372,7 +1372,8 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_enable(struct drm_bridge *bridge) +static void exynos_dsi_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); const struct drm_bridge_funcs *funcs = dsi->out_bridge->funcs; @@ -1390,19 +1391,20 @@ static void exynos_dsi_enable(struct drm_bridge *bridge) dsi->state |= DSIM_STATE_ENABLED; if (dsi->out_bridge) - funcs->pre_enable(dsi->out_bridge); + funcs->atomic_pre_enable(dsi->out_bridge, old_bridge_state); exynos_dsi_set_display_mode(bridge); exynos_dsi_set_display_enable(dsi, true); if (dsi->out_bridge) - funcs->enable(dsi->out_bridge); + funcs->atomic_enable(dsi->out_bridge, old_bridge_state); dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; return; } -static void exynos_dsi_disable(struct drm_bridge *bridge) +static void exynos_dsi_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); const struct drm_bridge_funcs *funcs = dsi->out_bridge->funcs; @@ -1413,12 +1415,12 @@ static void exynos_dsi_disable(struct drm_bridge *bridge) dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; if (dsi->out_bridge) - funcs->disable(dsi->out_bridge); + funcs->atomic_disable(dsi->out_bridge, old_bridge_state); exynos_dsi_set_display_enable(dsi, false); if (dsi->out_bridge) - funcs->post_disable(dsi->out_bridge); + funcs->atomic_post_disable(dsi->out_bridge, old_bridge_state); dsi->state &= ~DSIM_STATE_ENABLED; pm_runtime_put_sync(dsi->dev); @@ -1433,8 +1435,11 @@ static int exynos_dsi_attach(struct drm_bridge *bridge, } static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_enable = exynos_dsi_atomic_enable, + .atomic_disable = exynos_dsi_atomic_disable, .attach = exynos_dsi_attach, }; @@ -1605,7 +1610,7 @@ static void exynos_dsi_unbind(struct device *dev, struct device *master, { struct exynos_dsi *dsi = dev_get_drvdata(dev); - exynos_dsi_disable(&dsi->bridge); + exynos_dsi_atomic_disable(&dsi->bridge, NULL); mipi_dsi_host_unregister(&dsi->dsi_host); }