From patchwork Wed Dec 15 10:15:29 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1827 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 913623F1EA for ; Wed, 15 Dec 2021 11:15:50 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id a23-20020a62bd17000000b004a3f6892612sf13321720pff.22 for ; Wed, 15 Dec 2021 02:15:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563348; cv=pass; d=google.com; s=arc-20160816; b=xqx+BHh9j4jyVAq821cWP8Wy/KpWGerYUlEXkLiR47sfa4hSugO//ztzob2mZFIeaf zd/HMlo1kTTgTItLFqG5Jx6UYGJjUoS0PcmJ2EgQo8ytA2xY4QCEi4Um6+XztxGVpkt6 HsfA5Il5aVOAJopAX/waPhyHSmlvac0fwCOBYzngZsoWFVjFq5LD2VdaX+KdHillz+Do CN9cycCIW3tImobY0pvcheS8WyLMTtWrYzknz+XNSFktSHymhiCeHRVGHc7xhY4HrHKl h/5OYAOpCvT3guj8il6MlHQVJeN1l8iMl25PPk4yaAmIPEqIhg6baGIiZnZYorQqCu4q 4rPA== 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=6tIpCz5RL2yJax0UD0xFggRQ/WSDMbBEJ4WR+P6A0X4=; b=Rt1Bw4aL5E2MNqym2FNMR6pP+AKD0Eee7mUQKEnBtbudCp3dfL//BPuGHnk+2Lhdyq DHR0Za2C8Fx+tyb56fojkTLT5AStX0NGP12m5xrfSs8+KvZrkSy9ODbsPrFZeU/MNkOw d9mSDBqWOlbpM6bbKV7RQXINEGpo8H9/Yd+c7d0+IQmcFHG3twb6P+QLKPr9gTmskt+r rC2L/c96906HFjhYHeT8vfO2yYDHfD5dY/LqzEWzBGgPfag5N0bxeUjvkEENlUgBhwu1 WmT5lExCOFTb8g320+cQxmDh0u5b/xYCVbVQXJP72Qm8I9uLNBv7sNU/zqjjoh8vzdEY 7Giw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HMVMNlo6; 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=6tIpCz5RL2yJax0UD0xFggRQ/WSDMbBEJ4WR+P6A0X4=; b=hZiuvStPP3xGBTZgX19wBZPSXbMoRZjPnrqYEcKUUunsazSriqhgIo7VIQQOsXqbmf YNETUgNhh/vItRNzvh9BuViaRSrkujOt06bIQED6emm0IkUNY2J5mTlvvorttaeA9k+J dJQDSa6Bj3hCr4vgBBTuReC3f1e1Bx8ILyvac= 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=6tIpCz5RL2yJax0UD0xFggRQ/WSDMbBEJ4WR+P6A0X4=; b=0bTDmVlnduU9ErRhHoOMdcb8C56cikgCcOgflY7dpZyEPvsJx6q765T2ULZaRQ516p Ez1aHmVm7k7r58B9ibVmd+XmKiFHPWJPEbxvWoa01jlJq2Ukm5If9A7a6LOu+E5C2pg+ dH3GSaIWmcme5Ix8fafjQ/IEvm7NkVyhDW2OJGv996pUgBp0bSz3CxwJNFSiwX7PEYGm WoppVdU2nV8fd+F5edxU1A0kHjtX7w8Cdz+bqix7NzFbPElJ6aQTLUMhvMUZqTwgWqlb 6VPV2c68fXhvT4OEf6s3aJ1M/tILJjIuq9miofGlewF5HUMTdQ9ibli37NRjy6NCWkCR f4TA== X-Gm-Message-State: AOAM530sXRp2sgqD7xjKLiCK4nMpWUBH+UFLt6oPCrg/Ur0nccV17ao6 BqkcDlse4GUr+TPpmme8TAbjKGFV X-Google-Smtp-Source: ABdhPJx5PK4/erBP4fw6bk6dTvRmqUOK+xlx8h+S7TdL49Hy6C32kY0bh4XHO7ftBFWBDO70WZYNuw== X-Received: by 2002:a17:902:b7ca:b0:148:a2f7:9d89 with SMTP id v10-20020a170902b7ca00b00148a2f79d89mr3637483plz.168.1639563348085; Wed, 15 Dec 2021 02:15:48 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:1946:: with SMTP id s6ls755452pfk.5.gmail; Wed, 15 Dec 2021 02:15:47 -0800 (PST) X-Received: by 2002:a65:5c87:: with SMTP id a7mr7527171pgt.600.1639563347349; Wed, 15 Dec 2021 02:15:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563347; cv=none; d=google.com; s=arc-20160816; b=cJsZOzzdW5bgzIwp9WNH3I7r7iDuQuHNU6qCxTGDu+dkKZ3Oc/CzrlayQs2KNZglKg c8NlLaMqwXjDzSu6uInKiguzRfgtlrv7+R8Stfgop/4A3ZW2UostG4ZS7o2ES29Q+1Cv 0Te5TqXbrBBZR1vJujcE/r8emtlXCkkpIkCxytzYOt3XsFJn9XTVccHQlVLnp24WLwmT R7DZOA+Gtt5VqewtMd3pfil2tmfk+CwKkYmrKUbqApTGcVUEkr3jywhKF1dFBawpeIF5 qa6i6FtsPeUZ8pPXDgSOOIRCiIPVilyhKx+BTz4fiblodu0fYMQET2tUXRnamIZJw7KT nw3w== 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=4RVJ1JFh0nGp4mR6xsbu8YLyMS3Djo2VpT6T0fYvhSg=; b=LfpErduNwTczAiDZP2Q8udT8WMXpliP3WcyrYQTzA+XheVMK75xabEfI0VqR2c9QaW vHhDuRyviWeCNgSZzWrC51dWOi0oWZU+QQ4lKuhOZOKyOYcvbbBQO0FWrDkSuhFIkhuz M65hglPE8+VxVE5yS25/QUNj8rrAb5x2LFGSOgLzHxtyBAOyrZXR3sZDMTsle/U2aCGp LADSrEvz+b7mQcXGFsEjgHQhgTInLGSzbD6lVHMqndjk/74HOQjve0WcezG2OO+GsuKj hg5GlrfQYd/InJwBKqZ5idqaqv6tq218kZ7A86QJaUVX69W+Oh42CpjQLSOywFz5FJmN fcBA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HMVMNlo6; 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 k4sor845708pfc.33.2021.12.15.02.15.47 for (Google Transport Security); Wed, 15 Dec 2021 02:15:47 -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:451:: with SMTP id 78mr7552317pge.427.1639563347095; Wed, 15 Dec 2021 02:15:47 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:a7:8328:d9c4:5bc9]) by smtp.gmail.com with ESMTPSA id v11sm2408149pfu.184.2021.12.15.02.15.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:15:46 -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 v4 1/6] drm: bridge: panel: Reset the connector state pointer Date: Wed, 15 Dec 2021 15:45:29 +0530 Message-Id: <20211215101534.45003-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211215101534.45003-1-jagan@amarulasolutions.com> References: <20211215101534.45003-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=HMVMNlo6; 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 --- 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; }