| Message ID | 20211215100459.44196-1-jagan@amarulasolutions.com |
|---|---|
| State | New |
| Headers |
Return-Path: <linux-amarula+bncBD7MFH7A7EEBBW7342GQMGQES3LXFBY@amarulasolutions.com> X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id F27713F157 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 15 Dec 2021 11:05:17 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id c15-20020a63ea0f000000b0033ab6c73a4bsf6272336pgi.20 for <linux-amarula@patchwork.amarulasolutions.com>; Wed, 15 Dec 2021 02:05:17 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639562716; cv=pass; d=google.com; s=arc-20160816; b=YCkDMyZ4TkFOhDfqmfqLTTNdvM/7H51Bc6wg/kMOhPGAMpcYq65PvD15VlP/7o6z8J dXGW4USZrztsqTG5Vav5YCiYd8tk9dkw51mgotJxtBESUFJQHJcGJK3orwnzXNrW4hpR VCmlrXT3M3FdG3v6D6t1kaDNlJ+pz/vlbgnpwSLmqm/rqB4fSHqx4CnH+kw/x0KiZ8zY PAdJ5jKJtlLMnpvp91HMGH1AiXB040kePT1weIwH00etfdyy9OLfbbQuFGsISWerKbJK 4jEaRILIiacOw+CB9AmvFjA8GGzt+PgvfcM8F2oz1Z3bs+1fI6GOCtXB/LXQ/LRzW1Sr DcsQ== 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:message-id:date:subject:cc:to :from:dkim-signature; bh=O575C1+UqHoxR5VG34AELMa9PC1GRfXEYeIQNXxH5nM=; b=zTrfjIeZeS3EFbl8//va0omniOZhBWiEdgsPb2i21zobbUhLXmlryxWdpaxXuplXpf fqILQsECF+RHNVcD7QsaZKgFHJNuD6ulqafamm6O+odbqGDkYDqZaac5i5qVDeRsfBBC k6FKp6hcaaQ23G3D6hatp2rz/XIgHQtFBzNGJeeikjWC4Hqj+Q3ljpXPPutEtFh0UyKP qTx4zoe37WFf/eoKMS+s7n7J6WE+bC8qppiZVw4rU/WiyocfolG9wZePf1Jx0QnKBoy2 7Z0ipGpuUK5EyU7HFrmmFioCTg0+X4Skc59iWuLwated1DP8pqBJPJaKfX0NXGPlNmId LNzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=frgDETcB; 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:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :list-post:list-help:list-archive:list-unsubscribe; bh=O575C1+UqHoxR5VG34AELMa9PC1GRfXEYeIQNXxH5nM=; b=disrGxYYWwMmgETtCo2h64qg9CR+RRY6rWv3WDlBK8gytk5J48Eyeo988jiZCeJCzi JQXkwYcYi3RZQQIkVcHlngUiqRPzuzuiH/hRgShg3FvLRfjy+uL1Xu9Q1OH2ma/cMWVQ vfmooEdVnC53exFLVc8jHPgttapf+9uW87vMI= 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: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=O575C1+UqHoxR5VG34AELMa9PC1GRfXEYeIQNXxH5nM=; b=nBvjO3ldxSHI3VhYOJq+eiYDh2/5rpsf+PqxoauhNbOPA75QpBvRcPRfvCfTMjVnRH gNLQN5dz7p1XEKcJE46uI4AjoY2o7SAPKhPU48HX202isbTTOequyaFD14xoLYCPs7oq uanmaMb3qG35nSSaAn7xP2mTer4kz7qfJbeZ/U7wFgM6MrRHYtYyJfmTWNDqStxlz/M+ VtJjzJ94b8YUG5H7tA5eNLJgqjalq7mAPIHim3KkHD3J9ik7GkDFoDamLg7nqmX+66nG 7LGAmq6iFR5vbBhN+rHcw5Fct9ukm70kUp+8PUHS4siarJ3HeA6QhDzFRKlE510tibgN vFTA== X-Gm-Message-State: AOAM530mVSPy1qrZAx4wqvh1VWALCR9cp/NEkGGR/mAYuT14X+Vt7Tyq p3teeIHJU7ICLDNAXmEWpjILzpMi X-Google-Smtp-Source: ABdhPJzimvR2K3fpBhoJM1Rd8uGU4LIIWNx1rPBAZxTYJDsrnG5Q3wZILjHkwYFZ1O44XNUyxYEjqg== X-Received: by 2002:a17:90b:1082:: with SMTP id gj2mr629836pjb.187.1639562716020; Wed, 15 Dec 2021 02:05:16 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:4509:: with SMTP id s9ls679296pga.11.gmail; Wed, 15 Dec 2021 02:05:15 -0800 (PST) X-Received: by 2002:a63:3446:: with SMTP id b67mr7357692pga.424.1639562715279; Wed, 15 Dec 2021 02:05:15 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639562715; cv=none; d=google.com; s=arc-20160816; b=nDYPwIaIFqd+wOfwGi6c839vs0Qe6Cgs48jzzAXZoQ80a7+fXOw9tjeuSmkI3h7e9P aFs7xyskqt+alCTydhJPFEpZg2O04JyVmNDdFRlgdhBSmdQkgyMJCAdfyjIw8wyggZ00 fLigGyHqDOVXV5szhiNM65gY74dN+FaXu8G/V+fL86bw6tlsuOOZFCkxo6soMns4UDLU IuVmVxzGPAhks0P4/3wKlRRYbcbTxsuYCBpr7o/HTNAHMh/yosT+GsTPMsoYbHTrtIAF 8ePpmzGtMuCodjKxHjiaFvWOEagtmP2OJkT5hLI+32s6J450XNQUTRyW54Rk0wpR1CEb LoXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=s6I6PVDiB5pjSFYBufZhX7FLrObvdsszj8DUlsHONsA=; b=VLps2n+OGocO/n0pampewEGXHu+PyeSck6cuanh00/kVPxMGIEJDVxNDQiIXXDBLiG ahkaWYNc37Uju1TjPcrERvx63klNUJVlOUisawTWN0ncpovRJ3MEaOOg5optrwZBDvbK Vvmsppxiht2D4NKYLYYVlPaj4Nzt50jGENyr9sb4n5B02Nz+WWG36YP13TuPXqDmqqzr 3V68yJjnLuk7mEDIZSt7qm2IEgPdpa3pYDpPWOZ84yi4D0SAkA1X64NPAZeGPGjpaj8C vux+KEShKebVv0MOBmgaaJRTxrI506550UhIPeWxkAGbJaaDtNVjntS3wYd+WJki6Rz2 7r5w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=frgDETcB; 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 u3sor846684pfk.41.2021.12.15.02.05.15 for <linux-amarula@amarulasolutions.com> (Google Transport Security); Wed, 15 Dec 2021 02:05:15 -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:fe4a:: with SMTP id x10mr7181417pgj.531.1639562714968; Wed, 15 Dec 2021 02:05:14 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:a7:8328:d9c4:5bc9]) by smtp.gmail.com with ESMTPSA id e7sm2050014pfv.156.2021.12.15.02.05.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:05:14 -0800 (PST) From: Jagan Teki <jagan@amarulasolutions.com> To: Andrzej Hajda <a.hajda@samsung.com>, Neil Armstrong <narmstrong@baylibre.com>, Robert Foss <robert.foss@linaro.org>, Laurent Pinchart <Laurent.pinchart@ideasonboard.com>, Marek Szyprowski <m.szyprowski@samsung.com> Cc: devicetree@vger.kernel.org, linux-amarula@amarulasolutions.com, Jagan Teki <jagan@amarulasolutions.com> Subject: [PATCH v2] drm: bridge: tc358764: Use drm panel_bridge API Date: Wed, 15 Dec 2021 15:34:59 +0530 Message-Id: <20211215100459.44196-1-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 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=frgDETcB; 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: <linux-amarula.amarulasolutions.com> X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/post>, <mailto:linux-amarula@amarulasolutions.com> List-Help: <https://support.google.com/a/amarulasolutions.com/bin/topic.py?topic=25838>, <mailto:linux-amarula+help@amarulasolutions.com> List-Archive: <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/> List-Unsubscribe: <mailto:googlegroups-manage+476853432473+unsubscribe@googlegroups.com>, <https://groups.google.com/a/amarulasolutions.com/group/linux-amarula/subscribe> |
| Series |
[v2] drm: bridge: tc358764: Use drm panel_bridge API
|
|
Commit Message
Jagan Teki
Dec. 15, 2021, 10:04 a.m. UTC
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 panel healpers.
This simplifies the driver and allows all components in the display
pipeline to be treated as bridges.
Signed-off-by: Jagan Teki <jagan@amarulasolutions.com>
---
Changes for v2:
- s/panel_bridge/next_bridge
- drop unneeded headers
drivers/gpu/drm/bridge/tc358764.c | 104 ++----------------------------
1 file changed, 6 insertions(+), 98 deletions(-)
Comments
Hi Jagan, On 15.12.2021 11:04, Jagan Teki wrote: > 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 panel healpers. > > This simplifies the driver and allows all components in the display > pipeline to be treated as bridges. > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> I just tested it on top of linux-next with "drm: of: Lookup if child node has panel or bridge" patch. Sadly it still doesn't work on Exynos5250-based Arndale board: OF: graph: no port node found in /soc/hdmi@14530000 [drm] Exynos DRM: using 14400000.fimd device for DMA mapping operations exynos-drm exynos-drm: bound 14400000.fimd (ops fimd_component_ops) exynos-drm exynos-drm: bound 14450000.mixer (ops mixer_component_ops) OF: graph: no port node found in /soc/dsi@14500000 exynos-drm exynos-drm: bound 14500000.dsi (ops exynos_dsi_component_ops) exynos-drm exynos-drm: bound 14530000.hdmi (ops hdmi_component_ops) exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes [drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 0 panfrost 11800000.gpu: clock rate = 533000000 panfrost 11800000.gpu: mali-t600 id 0x600 major 0x0 minor 0x0 status 0x1 panfrost 11800000.gpu: features: 00000000,10206000, issues: 00000000,31b4dfff panfrost 11800000.gpu: Features: L2:0x07110206 Shader:0x00000000 Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xf JS:0x7 panfrost 11800000.gpu: shader_present=0xf l2_present=0x1 [drm] Initialized panfrost 1.2.0 20180908 for 11800000.gpu on minor 1 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 7 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x60/0x68 Modules linked in: CPU: 1 PID: 7 Comm: kworker/u4:0 Not tainted 5.16.0-rc5-next-20211214-00004-gac0282c4faed #11089 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound deferred_probe_work_func [<c01110d0>] (unwind_backtrace) from [<c010cab0>] (show_stack+0x10/0x14) [<c010cab0>] (show_stack) from [<c0b71c58>] (dump_stack_lvl+0x58/0x70) [<c0b71c58>] (dump_stack_lvl) from [<c0126c28>] (__warn+0x238/0x23c) [<c0126c28>] (__warn) from [<c0126cd8>] (warn_slowpath_fmt+0xac/0xb4) [<c0126cd8>] (warn_slowpath_fmt) from [<c064e95c>] (drm_atomic_helper_connector_duplicate_state+0x60/0x68) [<c064e95c>] (drm_atomic_helper_connector_duplicate_state) from [<c066870c>] (drm_atomic_get_connector_state+0xd8/0x190) [<c066870c>] (drm_atomic_get_connector_state) from [<c0669724>] (__drm_atomic_helper_set_config+0x2a0/0x368) [<c0669724>] (__drm_atomic_helper_set_config) from [<c0680b38>] (drm_client_modeset_commit_atomic+0x178/0x27c) [<c0680b38>] (drm_client_modeset_commit_atomic) from [<c0680cf8>] (drm_client_modeset_commit_locked+0x48/0x1d0) [<c0680cf8>] (drm_client_modeset_commit_locked) from [<c0680ea4>] (drm_client_modeset_commit+0x24/0x40) [<c0680ea4>] (drm_client_modeset_commit) from [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked+0x64/0xc8) [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0652c78>] (drm_fb_helper_set_par+0x38/0x64) [<c0652c78>] (drm_fb_helper_set_par) from [<c05bc048>] (fbcon_init+0x48c/0x510) [<c05bc048>] (fbcon_init) from [<c0608c68>] (visual_init+0xc0/0x108) [<c0608c68>] (visual_init) from [<c0609e90>] (do_bind_con_driver+0x1ac/0x388) [<c0609e90>] (do_bind_con_driver) from [<c060a3c8>] (do_take_over_console+0x13c/0x1c8) [<c060a3c8>] (do_take_over_console) from [<c05b9200>] (do_fbcon_takeover+0x74/0xcc) [<c05b9200>] (do_fbcon_takeover) from [<c05b3a10>] (register_framebuffer+0x1c8/0x2d8) [<c05b3a10>] (register_framebuffer) from [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock+0x440/0x65c) [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock) from [<c063e0d4>] (drm_kms_helper_hotplug_event+0x24/0x30) [<c063e0d4>] (drm_kms_helper_hotplug_event) from [<c0691178>] (exynos_dsi_host_attach+0x170/0x2a4) [<c0691178>] (exynos_dsi_host_attach) from [<c069d224>] (tc358764_probe+0xe8/0x160) [<c069d224>] (tc358764_probe) from [<c06b7170>] (really_probe+0x190/0x450) [<c06b7170>] (really_probe) from [<c06b74d4>] (__driver_probe_device+0xa4/0x204) [<c06b74d4>] (__driver_probe_device) from [<c06b7668>] (driver_probe_device+0x34/0xd4) [<c06b7668>] (driver_probe_device) from [<c06b7a44>] (__device_attach_driver+0xb0/0x11c) [<c06b7a44>] (__device_attach_driver) from [<c06b5254>] (bus_for_each_drv+0x70/0xb4) [<c06b5254>] (bus_for_each_drv) from [<c06b6f40>] (__device_attach+0xe0/0x178) [<c06b6f40>] (__device_attach) from [<c06b5fcc>] (bus_probe_device+0x88/0x90) [<c06b5fcc>] (bus_probe_device) from [<c06b64ec>] (deferred_probe_work_func+0x4c/0xe8) [<c06b64ec>] (deferred_probe_work_func) from [<c014897c>] (process_one_work+0x2c8/0x7ec) [<c014897c>] (process_one_work) from [<c0148ef0>] (worker_thread+0x50/0x584) [<c0148ef0>] (worker_thread) from [<c01512ec>] (kthread+0x13c/0x19c) [<c01512ec>] (kthread) from [<c0100108>] (ret_from_fork+0x14/0x2c) Exception stack(0xc1cc1fb0 to 0xc1cc1ff8) 1fa0: 00000000 00000000 00000000 00000000 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 21503 hardirqs last enabled at (21509): [<c01a3b3c>] vprintk_emit+0x270/0x2b4 hardirqs last disabled at (21514): [<c01a3af8>] vprintk_emit+0x22c/0x2b4 softirqs last enabled at (18950): [<c01016fc>] __do_softirq+0x4cc/0x5ec softirqs last disabled at (18945): [<c0130154>] irq_exit+0x1cc/0x200 ---[ end trace 0000000000000000 ]--- ------------[ cut here ]------------ WARNING: CPU: 1 PID: 7 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x60/0x68 Modules linked in: CPU: 1 PID: 7 Comm: kworker/u4:0 Tainted: G W 5.16.0-rc5-next-20211214-00004-gac0282c4faed #11089 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound deferred_probe_work_func [<c01110d0>] (unwind_backtrace) from [<c010cab0>] (show_stack+0x10/0x14) [<c010cab0>] (show_stack) from [<c0b71c58>] (dump_stack_lvl+0x58/0x70) [<c0b71c58>] (dump_stack_lvl) from [<c0126c28>] (__warn+0x238/0x23c) [<c0126c28>] (__warn) from [<c0126cd8>] (warn_slowpath_fmt+0xac/0xb4) [<c0126cd8>] (warn_slowpath_fmt) from [<c064e95c>] (drm_atomic_helper_connector_duplicate_state+0x60/0x68) [<c064e95c>] (drm_atomic_helper_connector_duplicate_state) from [<c066870c>] (drm_atomic_get_connector_state+0xd8/0x190) [<c066870c>] (drm_atomic_get_connector_state) from [<c0669724>] (__drm_atomic_helper_set_config+0x2a0/0x368) [<c0669724>] (__drm_atomic_helper_set_config) from [<c0680b38>] (drm_client_modeset_commit_atomic+0x178/0x27c) [<c0680b38>] (drm_client_modeset_commit_atomic) from [<c0680cf8>] (drm_client_modeset_commit_locked+0x48/0x1d0) [<c0680cf8>] (drm_client_modeset_commit_locked) from [<c0651d78>] (drm_fb_helper_pan_display+0x90/0x1c4) [<c0651d78>] (drm_fb_helper_pan_display) from [<c05b2bd0>] (fb_pan_display+0xcc/0x138) [<c05b2bd0>] (fb_pan_display) from [<c05bd144>] (bit_update_start+0x14/0x30) [<c05bd144>] (bit_update_start) from [<c05bad50>] (fbcon_switch+0x2d0/0x3e4) [<c05bad50>] (fbcon_switch) from [<c0609c14>] (redraw_screen+0x15c/0x22c) [<c0609c14>] (redraw_screen) from [<c05ba904>] (fbcon_prepare_logo+0x2d4/0x450) [<c05ba904>] (fbcon_prepare_logo) from [<c05bbf70>] (fbcon_init+0x3b4/0x510) [<c05bbf70>] (fbcon_init) from [<c0608c68>] (visual_init+0xc0/0x108) [<c0608c68>] (visual_init) from [<c0609e90>] (do_bind_con_driver+0x1ac/0x388) [<c0609e90>] (do_bind_con_driver) from [<c060a3c8>] (do_take_over_console+0x13c/0x1c8) [<c060a3c8>] (do_take_over_console) from [<c05b9200>] (do_fbcon_takeover+0x74/0xcc) [<c05b9200>] (do_fbcon_takeover) from [<c05b3a10>] (register_framebuffer+0x1c8/0x2d8) [<c05b3a10>] (register_framebuffer) from [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock+0x440/0x65c) [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock) from [<c063e0d4>] (drm_kms_helper_hotplug_event+0x24/0x30) [<c063e0d4>] (drm_kms_helper_hotplug_event) from [<c0691178>] (exynos_dsi_host_attach+0x170/0x2a4) [<c0691178>] (exynos_dsi_host_attach) from [<c069d224>] (tc358764_probe+0xe8/0x160) [<c069d224>] (tc358764_probe) from [<c06b7170>] (really_probe+0x190/0x450) [<c06b7170>] (really_probe) from [<c06b74d4>] (__driver_probe_device+0xa4/0x204) [<c06b74d4>] (__driver_probe_device) from [<c06b7668>] (driver_probe_device+0x34/0xd4) [<c06b7668>] (driver_probe_device) from [<c06b7a44>] (__device_attach_driver+0xb0/0x11c) [<c06b7a44>] (__device_attach_driver) from [<c06b5254>] (bus_for_each_drv+0x70/0xb4) [<c06b5254>] (bus_for_each_drv) from [<c06b6f40>] (__device_attach+0xe0/0x178) [<c06b6f40>] (__device_attach) from [<c06b5fcc>] (bus_probe_device+0x88/0x90) [<c06b5fcc>] (bus_probe_device) from [<c06b64ec>] (deferred_probe_work_func+0x4c/0xe8) [<c06b64ec>] (deferred_probe_work_func) from [<c014897c>] (process_one_work+0x2c8/0x7ec) [<c014897c>] (process_one_work) from [<c0148ef0>] (worker_thread+0x50/0x584) [<c0148ef0>] (worker_thread) from [<c01512ec>] (kthread+0x13c/0x19c) [<c01512ec>] (kthread) from [<c0100108>] (ret_from_fork+0x14/0x2c) Exception stack(0xc1cc1fb0 to 0xc1cc1ff8) 1fa0: 00000000 00000000 00000000 00000000 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 21591 hardirqs last enabled at (21597): [<c01a3b3c>] vprintk_emit+0x270/0x2b4 hardirqs last disabled at (21602): [<c01a3af8>] vprintk_emit+0x22c/0x2b4 softirqs last enabled at (18950): [<c01016fc>] __do_softirq+0x4cc/0x5ec softirqs last disabled at (18945): [<c0130154>] irq_exit+0x1cc/0x200 ---[ end trace 0000000000000000 ]--- Console: switching to colour frame buffer device 146x42 ------------[ cut here ]------------ WARNING: CPU: 1 PID: 7 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x60/0x68 Modules linked in: CPU: 1 PID: 7 Comm: kworker/u4:0 Tainted: G W 5.16.0-rc5-next-20211214-00004-gac0282c4faed #11089 Hardware name: Samsung Exynos (Flattened Device Tree) Workqueue: events_unbound deferred_probe_work_func [<c01110d0>] (unwind_backtrace) from [<c010cab0>] (show_stack+0x10/0x14) [<c010cab0>] (show_stack) from [<c0b71c58>] (dump_stack_lvl+0x58/0x70) [<c0b71c58>] (dump_stack_lvl) from [<c0126c28>] (__warn+0x238/0x23c) [<c0126c28>] (__warn) from [<c0126cd8>] (warn_slowpath_fmt+0xac/0xb4) [<c0126cd8>] (warn_slowpath_fmt) from [<c064e95c>] (drm_atomic_helper_connector_duplicate_state+0x60/0x68) [<c064e95c>] (drm_atomic_helper_connector_duplicate_state) from [<c066870c>] (drm_atomic_get_connector_state+0xd8/0x190) [<c066870c>] (drm_atomic_get_connector_state) from [<c0669724>] (__drm_atomic_helper_set_config+0x2a0/0x368) [<c0669724>] (__drm_atomic_helper_set_config) from [<c0680b38>] (drm_client_modeset_commit_atomic+0x178/0x27c) [<c0680b38>] (drm_client_modeset_commit_atomic) from [<c0680cf8>] (drm_client_modeset_commit_locked+0x48/0x1d0) [<c0680cf8>] (drm_client_modeset_commit_locked) from [<c0651d78>] (drm_fb_helper_pan_display+0x90/0x1c4) [<c0651d78>] (drm_fb_helper_pan_display) from [<c05b2bd0>] (fb_pan_display+0xcc/0x138) [<c05b2bd0>] (fb_pan_display) from [<c05bd144>] (bit_update_start+0x14/0x30) [<c05bd144>] (bit_update_start) from [<c05bad50>] (fbcon_switch+0x2d0/0x3e4) [<c05bad50>] (fbcon_switch) from [<c0609c14>] (redraw_screen+0x15c/0x22c) [<c0609c14>] (redraw_screen) from [<c0609f9c>] (do_bind_con_driver+0x2b8/0x388) [<c0609f9c>] (do_bind_con_driver) from [<c060a3c8>] (do_take_over_console+0x13c/0x1c8) [<c060a3c8>] (do_take_over_console) from [<c05b9200>] (do_fbcon_takeover+0x74/0xcc) [<c05b9200>] (do_fbcon_takeover) from [<c05b3a10>] (register_framebuffer+0x1c8/0x2d8) [<c05b3a10>] (register_framebuffer) from [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock+0x440/0x65c) [<c06525bc>] (__drm_fb_helper_initial_config_and_unlock) from [<c063e0d4>] (drm_kms_helper_hotplug_event+0x24/0x30) [<c063e0d4>] (drm_kms_helper_hotplug_event) from [<c0691178>] (exynos_dsi_host_attach+0x170/0x2a4) [<c0691178>] (exynos_dsi_host_attach) from [<c069d224>] (tc358764_probe+0xe8/0x160) [<c069d224>] (tc358764_probe) from [<c06b7170>] (really_probe+0x190/0x450) [<c06b7170>] (really_probe) from [<c06b74d4>] (__driver_probe_device+0xa4/0x204) [<c06b74d4>] (__driver_probe_device) from [<c06b7668>] (driver_probe_device+0x34/0xd4) [<c06b7668>] (driver_probe_device) from [<c06b7a44>] (__device_attach_driver+0xb0/0x11c) [<c06b7a44>] (__device_attach_driver) from [<c06b5254>] (bus_for_each_drv+0x70/0xb4) [<c06b5254>] (bus_for_each_drv) from [<c06b6f40>] (__device_attach+0xe0/0x178) [<c06b6f40>] (__device_attach) from [<c06b5fcc>] (bus_probe_device+0x88/0x90) [<c06b5fcc>] (bus_probe_device) from [<c06b64ec>] (deferred_probe_work_func+0x4c/0xe8) [<c06b64ec>] (deferred_probe_work_func) from [<c014897c>] (process_one_work+0x2c8/0x7ec) [<c014897c>] (process_one_work) from [<c0148ef0>] (worker_thread+0x50/0x584) [<c0148ef0>] (worker_thread) from [<c01512ec>] (kthread+0x13c/0x19c) [<c01512ec>] (kthread) from [<c0100108>] (ret_from_fork+0x14/0x2c) Exception stack(0xc1cc1fb0 to 0xc1cc1ff8) 1fa0: 00000000 00000000 00000000 00000000 1fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 1fe0: 00000000 00000000 00000000 00000000 00000013 00000000 irq event stamp: 21675 hardirqs last enabled at (21681): [<c01a3b3c>] vprintk_emit+0x270/0x2b4 hardirqs last disabled at (21686): [<c01a3af8>] vprintk_emit+0x22c/0x2b4 softirqs last enabled at (18950): [<c01016fc>] __do_softirq+0x4cc/0x5ec softirqs last disabled at (18945): [<c0130154>] irq_exit+0x1cc/0x200 ---[ end trace 0000000000000000 ]--- exynos-drm exynos-drm: [drm] fb0: exynosdrmfb frame buffer device # ./modetest -Mexynos ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1312 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x60/0x68 Modules linked in: s5p_mfc exynos_gsc v4l2_mem2mem videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc CPU: 1 PID: 1312 Comm: modetest Tainted: G W 5.16.0-rc5-next-20211214-00004-gac0282c4faed #11089 Hardware name: Samsung Exynos (Flattened Device Tree) [<c01110d0>] (unwind_backtrace) from [<c010cab0>] (show_stack+0x10/0x14) [<c010cab0>] (show_stack) from [<c0b71c58>] (dump_stack_lvl+0x58/0x70) [<c0b71c58>] (dump_stack_lvl) from [<c0126c28>] (__warn+0x238/0x23c) [<c0126c28>] (__warn) from [<c0126cd8>] (warn_slowpath_fmt+0xac/0xb4) [<c0126cd8>] (warn_slowpath_fmt) from [<c064e95c>] (drm_atomic_helper_connector_duplicate_state+0x60/0x68) [<c064e95c>] (drm_atomic_helper_connector_duplicate_state) from [<c066870c>] (drm_atomic_get_connector_state+0xd8/0x190) [<c066870c>] (drm_atomic_get_connector_state) from [<c0669724>] (__drm_atomic_helper_set_config+0x2a0/0x368) [<c0669724>] (__drm_atomic_helper_set_config) from [<c0680b38>] (drm_client_modeset_commit_atomic+0x178/0x27c) [<c0680b38>] (drm_client_modeset_commit_atomic) from [<c0680cf8>] (drm_client_modeset_commit_locked+0x48/0x1d0) [<c0680cf8>] (drm_client_modeset_commit_locked) from [<c0680ea4>] (drm_client_modeset_commit+0x24/0x40) [<c0680ea4>] (drm_client_modeset_commit) from [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked+0x64/0xc8) [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0655fe0>] (drm_lastclose+0x30/0x4c) [<c0655fe0>] (drm_lastclose) from [<c065610c>] (drm_release+0x110/0x114) [<c065610c>] (drm_release) from [<c02e61d0>] (__fput+0x88/0x258) [<c02e61d0>] (__fput) from [<c014def8>] (task_work_run+0x8c/0xc8) [<c014def8>] (task_work_run) from [<c010c30c>] (do_work_pending+0x534/0x63c) [<c010c30c>] (do_work_pending) from [<c0100088>] (slow_work_pending+0xc/0x20) Exception stack(0xc1d31fb0 to 0xc1d31ff8) 1fa0: 00000000 0000001f e8fd3e00 00000000 1fc0: 00000001 00000003 00000000 00000006 00022188 00000000 b6fbd000 00000000 1fe0: b6ebeaa0 bea09aa8 0000e7c4 b6ebeac0 60000010 00000003 irq event stamp: 3205 hardirqs last enabled at (3213): [<c01a0ca4>] __up_console_sem+0x50/0x60 hardirqs last disabled at (3236): [<c0b76bbc>] __schedule+0x554/0x964 softirqs last enabled at (3232): [<c01016fc>] __do_softirq+0x4cc/0x5ec softirqs last disabled at (3221): [<c0130154>] irq_exit+0x1cc/0x200 ---[ end trace 0000000000000000 ]--- could not get [ 426.570917] ------------[ cut here ]------------ WARNING: CPU: 1 PID: 1312 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x60/0x68 Modules linked in: s5p_mfc exynos_gsc v4l2_mem2mem videobuf2_dma_contig videobuf2_memops videobuf2_v4l2 videobuf2_common videodev mc CPU: 1 PID: 1312 Comm: modetest Tainted: G W 5.16.0-rc5-next-20211214-00004-gac0282c4faed #11089 Hardware name: Samsung Exynos (Flattened Device Tree) [<c01110d0>] (unwind_backtrace) from [<c010cab0>] (show_stack+0x10/0x14) [<c010cab0>] (show_stack) from [<c0b71c58>] (dump_stack_lvl+0x58/0x70) [<c0b71c58>] (dump_stack_lvl) from [<c0126c28>] (__warn+0x238/0x23c) [<c0126c28>] (__warn) from [<c0126cd8>] (warn_slowpath_fmt+0xac/0xb4) [<c0126cd8>] (warn_slowpath_fmt) from [<c064e95c>] (drm_atomic_helper_connector_duplicate_state+0x60/0x68) [<c064e95c>] (drm_atomic_helper_connector_duplicate_state) from [<c066870c>] (drm_atomic_get_connector_state+0xd8/0x190) [<c066870c>] (drm_atomic_get_connector_state) from [<c0669724>] (__drm_atomic_helper_set_config+0x2a0/0x368) [<c0669724>] (__drm_atomic_helper_set_config) from [<c0680b38>] (drm_client_modeset_commit_atomic+0x178/0x27c) [<c0680b38>] (drm_client_modeset_commit_atomic) from [<c0680cf8>] (drm_client_modeset_commit_locked+0x48/0x1d0) [<c0680cf8>] (drm_client_modeset_commit_locked) from [<c0680ea4>] (drm_client_modeset_commit+0x24/0x40) [<c0680ea4>] (drm_client_modeset_commit) from [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked+0x64/0xc8) [<c0652bac>] (__drm_fb_helper_restore_fbdev_mode_unlocked) from [<c0655fe0>] (drm_lastclose+0x30/0x4c) [<c0655fe0>] (drm_lastclose) from [<c065610c>] (drm_release+0x110/0x114) [<c065610c>] (drm_release) from [<c02e61d0>] (__fput+0x88/0x258) [<c02e61d0>] (__fput) from [<c014def8>] (task_work_run+0x8c/0xc8) [<c014def8>] (task_work_run) from [<c012caac>] (do_exit+0x3f8/0xc1c) [<c012caac>] (do_exit) from [<c012e644>] (do_group_exit+0x2c/0xa0) [<c012e644>] (do_group_exit) from [<c013d024>] (get_signal+0x1d0/0xe6c) [<c013d024>] (get_signal) from [<c010bef4>] (do_work_pending+0x11c/0x63c) [<c010bef4>] (do_work_pending) from [<c0100088>] (slow_work_pending+0xc/0x20) Exception stack(0xc1d31fb0 to 0xc1d31ff8) 1fa0: 00000008 0000005f 00000002 00023388 1fc0: 00000001 000232a8 00000000 00023398 0000003e 00000000 00023360 00000000 1fe0: 00023590 bea09af8 00009ec0 00009e9c 80000010 ffffffff irq event stamp: 3693 hardirqs last enabled at (3701): [<c01a0ca4>] __up_console_sem+0x50/0x60 hardirqs last disabled at (3710): [<c01a0c90>] __up_console_sem+0x3c/0x60 softirqs last enabled at (3688): [<c01016fc>] __do_softirq+0x4cc/0x5ec softirqs last disabled at (3661): [<c0130154>] irq_exit+0x1cc/0x200 ---[ end trace 0000000000000000 ]--- connector 62: No such file or directory Segmentation fault > --- > Changes for v2: > - s/panel_bridge/next_bridge > - drop unneeded headers > > drivers/gpu/drm/bridge/tc358764.c | 104 ++---------------------------- > 1 file changed, 6 insertions(+), 98 deletions(-) > > diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c > index c1e35bdf9232..dca41ed32f8a 100644 > --- a/drivers/gpu/drm/bridge/tc358764.c > +++ b/drivers/gpu/drm/bridge/tc358764.c > @@ -16,14 +16,9 @@ > #include <video/mipi_display.h> > > #include <drm/drm_atomic_helper.h> > -#include <drm/drm_bridge.h> > -#include <drm/drm_crtc.h> > -#include <drm/drm_fb_helper.h> > #include <drm/drm_mipi_dsi.h> > #include <drm/drm_of.h> > -#include <drm/drm_panel.h> > #include <drm/drm_print.h> > -#include <drm/drm_probe_helper.h> > > #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end)) > #define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end)) > @@ -153,10 +148,9 @@ static const char * const tc358764_supplies[] = { > struct tc358764 { > struct device *dev; > struct drm_bridge bridge; > - struct drm_connector connector; > + struct drm_bridge *next_bridge; > struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; > struct gpio_desc *gpio_reset; > - struct drm_panel *panel; > int error; > }; > > @@ -210,12 +204,6 @@ static inline struct tc358764 *bridge_to_tc358764(struct drm_bridge *bridge) > return container_of(bridge, struct tc358764, bridge); > } > > -static inline > -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) > -{ > - return container_of(connector, struct tc358764, connector); > -} > - > static int tc358764_init(struct tc358764 *ctx) > { > u32 v = 0; > @@ -278,43 +266,11 @@ static void tc358764_reset(struct tc358764 *ctx) > usleep_range(1000, 2000); > } > > -static int tc358764_get_modes(struct drm_connector *connector) > -{ > - struct tc358764 *ctx = connector_to_tc358764(connector); > - > - return drm_panel_get_modes(ctx->panel, connector); > -} > - > -static const > -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { > - .get_modes = tc358764_get_modes, > -}; > - > -static const struct drm_connector_funcs tc358764_connector_funcs = { > - .fill_modes = drm_helper_probe_single_connector_modes, > - .destroy = drm_connector_cleanup, > - .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 void tc358764_disable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); > -} > - > static void tc358764_post_disable(struct drm_bridge *bridge) > { > struct tc358764 *ctx = bridge_to_tc358764(bridge); > int ret; > > - ret = drm_panel_unprepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); > tc358764_reset(ctx); > usleep_range(10000, 15000); > ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); > @@ -335,72 +291,25 @@ static void tc358764_pre_enable(struct drm_bridge *bridge) > ret = tc358764_init(ctx); > if (ret < 0) > dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); > - ret = drm_panel_prepare(ctx->panel); > - if (ret < 0) > - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); > -} > - > -static void tc358764_enable(struct drm_bridge *bridge) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - int ret = drm_panel_enable(ctx->panel); > - > - if (ret < 0) > - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); > } > > static int tc358764_attach(struct drm_bridge *bridge, > enum drm_bridge_attach_flags flags) > -{ > - struct tc358764 *ctx = bridge_to_tc358764(bridge); > - struct drm_device *drm = bridge->dev; > - int ret; > - > - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { > - DRM_ERROR("Fix bridge driver to make connector optional!"); > - return -EINVAL; > - } > - > - ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; > - ret = drm_connector_init(drm, &ctx->connector, > - &tc358764_connector_funcs, > - DRM_MODE_CONNECTOR_LVDS); > - if (ret) { > - DRM_ERROR("Failed to initialize connector\n"); > - return ret; > - } > - > - drm_connector_helper_add(&ctx->connector, > - &tc358764_connector_helper_funcs); > - drm_connector_attach_encoder(&ctx->connector, bridge->encoder); > - ctx->connector.funcs->reset(&ctx->connector); > - drm_connector_register(&ctx->connector); > - > - return 0; > -} > - > -static void tc358764_detach(struct drm_bridge *bridge) > { > struct tc358764 *ctx = bridge_to_tc358764(bridge); > > - drm_connector_unregister(&ctx->connector); > - ctx->panel = NULL; > - drm_connector_put(&ctx->connector); > + return drm_bridge_attach(bridge->encoder, ctx->next_bridge, bridge, flags); > } > > static const struct drm_bridge_funcs tc358764_bridge_funcs = { > - .disable = tc358764_disable, > .post_disable = tc358764_post_disable, > - .enable = tc358764_enable, > .pre_enable = tc358764_pre_enable, > .attach = tc358764_attach, > - .detach = tc358764_detach, > }; > > static int tc358764_parse_dt(struct tc358764 *ctx) > { > struct device *dev = ctx->dev; > - int ret; > > ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); > if (IS_ERR(ctx->gpio_reset)) { > @@ -408,12 +317,11 @@ static int tc358764_parse_dt(struct tc358764 *ctx) > return PTR_ERR(ctx->gpio_reset); > } > > - ret = drm_of_find_panel_or_bridge(ctx->dev->of_node, 1, 0, &ctx->panel, > - NULL); > - if (ret && ret != -EPROBE_DEFER) > - dev_err(dev, "cannot find panel (%d)\n", ret); > + ctx->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); > + if (IS_ERR(ctx->next_bridge)) > + return PTR_ERR(ctx->next_bridge); > > - return ret; > + return 0; > } > > static int tc358764_configure_regulators(struct tc358764 *ctx) Best regards
Hi Marek, On Wed, Dec 15, 2021 at 5:30 PM Marek Szyprowski <m.szyprowski@samsung.com> wrote: > > Hi Jagan, > > On 15.12.2021 11:04, Jagan Teki wrote: > > 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 panel healpers. > > > > This simplifies the driver and allows all components in the display > > pipeline to be treated as bridges. > > > > Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> > > I just tested it on top of linux-next with "drm: of: Lookup if child > node has panel or bridge" patch. Sadly it still doesn't work on > Exynos5250-based Arndale board: > > OF: graph: no port node found in /soc/hdmi@14530000 > [drm] Exynos DRM: using 14400000.fimd device for DMA mapping operations > exynos-drm exynos-drm: bound 14400000.fimd (ops fimd_component_ops) > exynos-drm exynos-drm: bound 14450000.mixer (ops mixer_component_ops) > OF: graph: no port node found in /soc/dsi@14500000 > exynos-drm exynos-drm: bound 14500000.dsi (ops exynos_dsi_component_ops) > exynos-drm exynos-drm: bound 14530000.hdmi (ops hdmi_component_ops) > exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes > exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes > [drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 0 > panfrost 11800000.gpu: clock rate = 533000000 > panfrost 11800000.gpu: mali-t600 id 0x600 major 0x0 minor 0x0 status 0x1 > panfrost 11800000.gpu: features: 00000000,10206000, issues: > 00000000,31b4dfff > panfrost 11800000.gpu: Features: L2:0x07110206 Shader:0x00000000 > Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xf JS:0x7 > panfrost 11800000.gpu: shader_present=0xf l2_present=0x1 > [drm] Initialized panfrost 1.2.0 20180908 for 11800000.gpu on minor 1 > ------------[ cut here ]------------ > WARNING: CPU: 1 PID: 7 at drivers/gpu/drm/drm_atomic_state_helper.c:494 > drm_atomic_helper_connector_duplicate_state+0x60/0x68 Known problem, it require 1/6 from Bridge conversation series. We can move this patch into conversion series next time or while merging. Thanks, Jagan.
Hi Jagan, On 15.12.2021 13:59, Jagan Teki wrote: > On Wed, Dec 15, 2021 at 5:30 PM Marek Szyprowski > <m.szyprowski@samsung.com> wrote: >> On 15.12.2021 11:04, Jagan Teki wrote: >>> 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 panel healpers. >>> >>> This simplifies the driver and allows all components in the display >>> pipeline to be treated as bridges. >>> >>> Signed-off-by: Jagan Teki <jagan@amarulasolutions.com> >> I just tested it on top of linux-next with "drm: of: Lookup if child >> node has panel or bridge" patch. Sadly it still doesn't work on >> Exynos5250-based Arndale board: >> >> OF: graph: no port node found in /soc/hdmi@14530000 >> [drm] Exynos DRM: using 14400000.fimd device for DMA mapping operations >> exynos-drm exynos-drm: bound 14400000.fimd (ops fimd_component_ops) >> exynos-drm exynos-drm: bound 14450000.mixer (ops mixer_component_ops) >> OF: graph: no port node found in /soc/dsi@14500000 >> exynos-drm exynos-drm: bound 14500000.dsi (ops exynos_dsi_component_ops) >> exynos-drm exynos-drm: bound 14530000.hdmi (ops hdmi_component_ops) >> exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes >> exynos-drm exynos-drm: [drm] Cannot find any crtc or sizes >> [drm] Initialized exynos 1.1.0 20180330 for exynos-drm on minor 0 >> panfrost 11800000.gpu: clock rate = 533000000 >> panfrost 11800000.gpu: mali-t600 id 0x600 major 0x0 minor 0x0 status 0x1 >> panfrost 11800000.gpu: features: 00000000,10206000, issues: >> 00000000,31b4dfff >> panfrost 11800000.gpu: Features: L2:0x07110206 Shader:0x00000000 >> Tiler:0x00000809 Mem:0x1 MMU:0x00002830 AS:0xf JS:0x7 >> panfrost 11800000.gpu: shader_present=0xf l2_present=0x1 >> [drm] Initialized panfrost 1.2.0 20180908 for 11800000.gpu on minor 1 >> ------------[ cut here ]------------ >> WARNING: CPU: 1 PID: 7 at drivers/gpu/drm/drm_atomic_state_helper.c:494 >> drm_atomic_helper_connector_duplicate_state+0x60/0x68 > Known problem, it require 1/6 from Bridge conversation series. We can > move this patch into conversion series next time or while merging. Indeed, with the 1/6 patch it works fine on Exynos5250 based Arndale board. Tested-by: Marek Szyprowski <m.szyprowski@samsung.com> Best regards
diff --git a/drivers/gpu/drm/bridge/tc358764.c b/drivers/gpu/drm/bridge/tc358764.c index c1e35bdf9232..dca41ed32f8a 100644 --- a/drivers/gpu/drm/bridge/tc358764.c +++ b/drivers/gpu/drm/bridge/tc358764.c @@ -16,14 +16,9 @@ #include <video/mipi_display.h> #include <drm/drm_atomic_helper.h> -#include <drm/drm_bridge.h> -#include <drm/drm_crtc.h> -#include <drm/drm_fb_helper.h> #include <drm/drm_mipi_dsi.h> #include <drm/drm_of.h> -#include <drm/drm_panel.h> #include <drm/drm_print.h> -#include <drm/drm_probe_helper.h> #define FLD_MASK(start, end) (((1 << ((start) - (end) + 1)) - 1) << (end)) #define FLD_VAL(val, start, end) (((val) << (end)) & FLD_MASK(start, end)) @@ -153,10 +148,9 @@ static const char * const tc358764_supplies[] = { struct tc358764 { struct device *dev; struct drm_bridge bridge; - struct drm_connector connector; + struct drm_bridge *next_bridge; struct regulator_bulk_data supplies[ARRAY_SIZE(tc358764_supplies)]; struct gpio_desc *gpio_reset; - struct drm_panel *panel; int error; }; @@ -210,12 +204,6 @@ static inline struct tc358764 *bridge_to_tc358764(struct drm_bridge *bridge) return container_of(bridge, struct tc358764, bridge); } -static inline -struct tc358764 *connector_to_tc358764(struct drm_connector *connector) -{ - return container_of(connector, struct tc358764, connector); -} - static int tc358764_init(struct tc358764 *ctx) { u32 v = 0; @@ -278,43 +266,11 @@ static void tc358764_reset(struct tc358764 *ctx) usleep_range(1000, 2000); } -static int tc358764_get_modes(struct drm_connector *connector) -{ - struct tc358764 *ctx = connector_to_tc358764(connector); - - return drm_panel_get_modes(ctx->panel, connector); -} - -static const -struct drm_connector_helper_funcs tc358764_connector_helper_funcs = { - .get_modes = tc358764_get_modes, -}; - -static const struct drm_connector_funcs tc358764_connector_funcs = { - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .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 void tc358764_disable(struct drm_bridge *bridge) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - int ret = drm_panel_disable(bridge_to_tc358764(bridge)->panel); - - if (ret < 0) - dev_err(ctx->dev, "error disabling panel (%d)\n", ret); -} - static void tc358764_post_disable(struct drm_bridge *bridge) { struct tc358764 *ctx = bridge_to_tc358764(bridge); int ret; - ret = drm_panel_unprepare(ctx->panel); - if (ret < 0) - dev_err(ctx->dev, "error unpreparing panel (%d)\n", ret); tc358764_reset(ctx); usleep_range(10000, 15000); ret = regulator_bulk_disable(ARRAY_SIZE(ctx->supplies), ctx->supplies); @@ -335,72 +291,25 @@ static void tc358764_pre_enable(struct drm_bridge *bridge) ret = tc358764_init(ctx); if (ret < 0) dev_err(ctx->dev, "error initializing bridge (%d)\n", ret); - ret = drm_panel_prepare(ctx->panel); - if (ret < 0) - dev_err(ctx->dev, "error preparing panel (%d)\n", ret); -} - -static void tc358764_enable(struct drm_bridge *bridge) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - int ret = drm_panel_enable(ctx->panel); - - if (ret < 0) - dev_err(ctx->dev, "error enabling panel (%d)\n", ret); } static int tc358764_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) -{ - struct tc358764 *ctx = bridge_to_tc358764(bridge); - struct drm_device *drm = bridge->dev; - int ret; - - if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) { - DRM_ERROR("Fix bridge driver to make connector optional!"); - return -EINVAL; - } - - ctx->connector.polled = DRM_CONNECTOR_POLL_HPD; - ret = drm_connector_init(drm, &ctx->connector, - &tc358764_connector_funcs, - DRM_MODE_CONNECTOR_LVDS); - if (ret) { - DRM_ERROR("Failed to initialize connector\n"); - return ret; - } - - drm_connector_helper_add(&ctx->connector, - &tc358764_connector_helper_funcs); - drm_connector_attach_encoder(&ctx->connector, bridge->encoder); - ctx->connector.funcs->reset(&ctx->connector); - drm_connector_register(&ctx->connector); - - return 0; -} - -static void tc358764_detach(struct drm_bridge *bridge) { struct tc358764 *ctx = bridge_to_tc358764(bridge); - drm_connector_unregister(&ctx->connector); - ctx->panel = NULL; - drm_connector_put(&ctx->connector); + return drm_bridge_attach(bridge->encoder, ctx->next_bridge, bridge, flags); } static const struct drm_bridge_funcs tc358764_bridge_funcs = { - .disable = tc358764_disable, .post_disable = tc358764_post_disable, - .enable = tc358764_enable, .pre_enable = tc358764_pre_enable, .attach = tc358764_attach, - .detach = tc358764_detach, }; static int tc358764_parse_dt(struct tc358764 *ctx) { struct device *dev = ctx->dev; - int ret; ctx->gpio_reset = devm_gpiod_get(dev, "reset", GPIOD_OUT_LOW); if (IS_ERR(ctx->gpio_reset)) { @@ -408,12 +317,11 @@ static int tc358764_parse_dt(struct tc358764 *ctx) return PTR_ERR(ctx->gpio_reset); } - ret = drm_of_find_panel_or_bridge(ctx->dev->of_node, 1, 0, &ctx->panel, - NULL); - if (ret && ret != -EPROBE_DEFER) - dev_err(dev, "cannot find panel (%d)\n", ret); + ctx->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 1, 0); + if (IS_ERR(ctx->next_bridge)) + return PTR_ERR(ctx->next_bridge); - return ret; + return 0; } static int tc358764_configure_regulators(struct tc358764 *ctx)