From patchwork Thu Mar 3 16:36:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1856 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 46D4B3F236 for ; Thu, 3 Mar 2022 17:37:47 +0100 (CET) Received: by mail-pl1-f199.google.com with SMTP id b7-20020a170902a9c700b0014fda723ad4sf3189827plr.15 for ; Thu, 03 Mar 2022 08:37:47 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646325466; cv=pass; d=google.com; s=arc-20160816; b=BM0ca2Cn5rdw8jGn5c0CSlkpLLKIgxfToWSYB3CtYK/xVh1p7VLPE9l0kJGz1xlUpi RZuaolU8sVtOQQvQ8Sb83IAYzzp7YyVynbpnR2AMiaih+xrcevd26gn1R3dW/lSrOckb goWrxofev2I43do0fNEVPQDiUXIaUopAtsgTPavtu2kR+vyX9q+7qk2u9fnJS44d9Y+g VlkD8AFdFA6c5OHs6ZbTCmLSs/aVCYYIgtGio8NJHrrMa4vZL0EJ0VJZe9N0hd1OIvG+ fqCnt+0gKsn3RZK8nFLB9PYdUJHb8A9KdFAG9GD+4KhdpbvfuJ2o6ReTMC6oZnGCVjco Z7Lg== 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=p9X/g6eGuEQukGQfTMG23G4ShEG/rWP+t2/EFrUVB6M=; b=qKJ/bdNOnK1qb+uEnvzPIGgRK8IR3vR+wGmEeBd9kJIl5dMIAoLGSs2oCUJcz9y4+7 5dQO/TLp64EE2j2ce6NrcRr9KgdqB7JawQT5sGdspd692hmG1pjkUb/Cn+XtE0S2/OGA 4OlBRTs/cssEuPHqlE8Ew77ferCsndL94ecsr+SpieIC/zxiQmD7aNeCtKJtcYGoAPR2 P/KbOZ1Ntorz+8dRI4aA3aP9kQuvzVk4XEsa7K/Tn870gDj5E/dEkaLyySIc2p3K2kZ0 XSJE14XrJmId+R1qgBxg2mx3wVgRB4kX7R61B4LIsaBapdCmgRuO8bC+ZWJSg+a7OaDO /VZw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gVrdwHfK; 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=p9X/g6eGuEQukGQfTMG23G4ShEG/rWP+t2/EFrUVB6M=; b=i5uVRr8dn2nXS4gzsijgENh5xwXLcBl3YQ72iDOLf6dTfWg57ciGa78hyQgtlXhswZ MngvFcTfq/2Sr++dAv7fNc0ru9+DY2Yr7yu5a50yyMRO4Hr2g5gStIKeoAnEicWO+B72 3XtDcd+TeJpOCj3dM3JOoJGpPvQepHLHD31Vs= 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=p9X/g6eGuEQukGQfTMG23G4ShEG/rWP+t2/EFrUVB6M=; b=ueu+yipVXdsJ8X5cHavUxFskYydp7qEUcVNYv5k6xHteUNShdvwHIH34XE7WQijnx9 Bv6FKyEgwRfvKi0Wcvv5AV+TPW4tZowxb2ei1GroGYptJjOVcah/aR6ElQXYYPZeGyNg 8i+K1lyZ2oID/sYSPo2iFrBIK3alBCppQWplCHYbMruYOstwSaZi7xSRWvjhD09yeK6m 8DG+5D6BevZzdE5HEZ+rWRLjPBu9naTwceziJQ+M/k+Rf5sbyPkeQ90vd7NZAx4GPFi0 nE2mO4XjRgGe3y/2CBDTYBxDeXBiqDbsXcZkXOb/A0S+znf2UbNu7CuzMqaThKibaIWl 60vg== X-Gm-Message-State: AOAM533pXgcfwZRaHZ3Uxuq3NE6LFiezmU77RBTs+fk2+uAKx174nSnI x4GOPtO3X4iI/MLFcY481SAmzmN7 X-Google-Smtp-Source: ABdhPJzIIqDD5ezG3T1lQ7G6L+j99YdBktPXbDtCtzksFSSAXIPB6crwazKMtKaXyp68L/qIqJaMcw== X-Received: by 2002:a17:902:8a97:b0:14a:c625:eb2d with SMTP id p23-20020a1709028a9700b0014ac625eb2dmr37451379plo.26.1646325466107; Thu, 03 Mar 2022 08:37:46 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:bb8c:b0:14d:d65a:dbdb with SMTP id m12-20020a170902bb8c00b0014dd65adbdbls2500648pls.6.gmail; Thu, 03 Mar 2022 08:37:45 -0800 (PST) X-Received: by 2002:a17:902:f712:b0:149:d41a:baa8 with SMTP id h18-20020a170902f71200b00149d41abaa8mr36538475plo.115.1646325465338; Thu, 03 Mar 2022 08:37:45 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646325465; cv=none; d=google.com; s=arc-20160816; b=gsyu3MWR0SAy/uxHPhG91cAHl9/+rPoAG5omEyUZ7Gzik/6WptQOiZYPeTMemmk9sB Pv+fzmTyADOe1lOo8A2TATDTCNrRYEKBqe342aR/2JT3mFA2plR065toysgy5F4B8g/7 fMzYEUd/OTJedQJwKTo8Rs3X+nZxaMb6UsLyDk5tMMY96hfsKtoI+Ou9ALzQb/uWRG03 Ms6ymfsUJa1eytXRF4nXo+D34DRIatkV2aRJP4sdRDr1AyRh242FbYOqEPtuC3Fwf/iK 1RuZFjFTNUelfkPc6NPlizlGhbq1lsuzwcPQvGXkO04ryEdzuECICPoUi9aAPu7aylyD tYfQ== 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=uLbgWPGTvslOBS5UpaKI0SJIKPvPO+ELrEhMx1Q0zDM=; b=ESLsWIc3/k2SV8OwB8xMxud81336ECmTtYCtIl0uvd25dj4gkv7+Tvy1KJiiYi1mkG 6Lv5UdQomdE9LCwBp/xBZNZ6TSmjlZyHP1qm98lI8faLKyLinvujhvSEijIpldPQ23Aj mTu/teXkmCH+muc1+LlXsIaXWCN+lMnxRh5LvYlXtDYjVvUQGr0tYhcdnSPwOjoBKhjT G0CGFqrP+QnL62MDJHyrgTzAmIfpXK6maj6dqaHWhqeAH4KjboMToiL4bRL8hiugcyuh 3551vpyg5BMZ8hy0wFo3lY+BWnQtGWBY4ifGfDn18uJG5JI764/wxFU4PsC5CTY1p7j9 YfLw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=gVrdwHfK; 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 y14-20020a17090322ce00b0014fe92899ebsor3198815plg.155.2022.03.03.08.37.45 for (Google Transport Security); Thu, 03 Mar 2022 08:37: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:a17:902:7041:b0:14f:c724:42c7 with SMTP id h1-20020a170902704100b0014fc72442c7mr36866699plt.11.1646325465047; Thu, 03 Mar 2022 08:37:45 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:4526:5253:a010:63f4]) by smtp.gmail.com with ESMTPSA id j20-20020a056a00235400b004e192221ec2sm3220983pfj.14.2022.03.03.08.37.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 08:37:44 -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 v6 2/6] drm: bridge: panel: Reset the connector state pointer Date: Thu, 3 Mar 2022 22:06:50 +0530 Message-Id: <20220303163654.3381470-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303163654.3381470-1-jagan@amarulasolutions.com> References: <20220303163654.3381470-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=gVrdwHfK; 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 hotplug event with drm_kms_helper_hotplug_event might fail if the connector state pointer is NULL. BUG observed in exynos dsi driver where drm_bridge_attach is trying to register a connector in panel_bridge before the hotplug event is triggered, WARNING: CPU: 1 PID: 1 at drivers/gpu/drm/drm_atomic_state_helper.c:494 drm_atomic_helper_connector_duplicate_state+0x94/0x9c Modules linked in: CPU: 1 PID: 1 Comm: swapper/0 Tainted: G W 5.16.0-rc1-00009-g704b1dbfa4c2 #11058 Hardware name: Samsung Exynos (Flattened Device Tree) [] (unwind_backtrace) from [] (show_stack+0x10/0x14) [] (show_stack) from [] (dump_stack_lvl+0x58/0x70) [] (dump_stack_lvl) from [] (__warn+0xd0/0x134) [] (__warn) from [] (warn_slowpath_fmt+0x5c/0xb4) [] (warn_slowpath_fmt) from [] (drm_atomic_helper_connector_duplicate_state+0x94/0x9c) [] (drm_atomic_helper_connector_duplicate_state) from [] (drm_atomic_get_connector_state+0xd4/0x190) [] (drm_atomic_get_connector_state) from [] (__drm_atomic_helper_set_config+0x314/0x368) [] (__drm_atomic_helper_set_config) from [] (drm_client_modeset_commit_atomic+0x170/0x278) [] (drm_client_modeset_commit_atomic) from [] (drm_client_modeset_commit_locked+0x60/0x1c8) [] (drm_client_modeset_commit_locked) from [] (drm_client_modeset_commit+0x24/0x40) [] (drm_client_modeset_commit) from [] (drm_fb_helper_set_par+0xb8/0xf8) [] (drm_fb_helper_set_par) from [] (fbcon_init+0x2c0/0x518) [] (fbcon_init) from [] (visual_init+0xc0/0x108) [] (visual_init) from [] (do_bind_con_driver+0x1b8/0x3a4) [] (do_bind_con_driver) from [] (do_take_over_console+0x13c/0x1e8) [] (do_take_over_console) from [] (do_fbcon_takeover+0x78/0xd8) [] (do_fbcon_takeover) from [] (register_framebuffer+0x208/0x2e0) [] (register_framebuffer) from [] (__drm_fb_helper_initial_config_and_unlock+0x400/0x63c) [] (__drm_fb_helper_initial_config_and_unlock) from [] (drm_kms_helper_hotplug_event+0x24/0x30) [] (drm_kms_helper_hotplug_event) from [] (exynos_dsi_host_attach+0x174/0x1fc) [] (exynos_dsi_host_attach) from [] (s6e8aa0_probe+0x1b4/0x218) So reset the atomic state for a given connector by freeing the state pointer and allocate a new empty state object. This can be done using connector funcs->reset helper and has to be done before the hotplug even calls. This patch calls the connector->funcs->reset in panel_bridge_attach. Signed-off-by: Jagan Teki Acked-by: Marek Szyprowski Tested-by: Marek Szyprowski --- Changes for v6, v5: - none Changes for v4: - new patch drivers/gpu/drm/bridge/panel.c | 3 +++ 1 file changed, 3 insertions(+) diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index b32295abd9e7..f6eea194482a 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -83,6 +83,9 @@ static int panel_bridge_attach(struct drm_bridge *bridge, drm_connector_attach_encoder(&panel_bridge->connector, bridge->encoder); + if (connector->funcs->reset) + connector->funcs->reset(connector); + return 0; }