From patchwork Mon Jan 17 08:42:21 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1840 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 1A08F3F067 for ; Mon, 17 Jan 2022 09:42:40 +0100 (CET) Received: by mail-pj1-f69.google.com with SMTP id x14-20020a17090a8a8e00b001b3b14c53afsf14366125pjn.6 for ; Mon, 17 Jan 2022 00:42:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642408959; cv=pass; d=google.com; s=arc-20160816; b=ihOMa7reVaMNdHzm5nyp23iQhlW6Moyr0gTbv+CWCcQw6kbTGVCTJu5Jdi3aXOsLDc mQwow71KNCmzrFT/XeI/3yPULkT8ErbsdFTwQC5TGCFPOj75JpFRx3S66F5UDANqHqVl CYrjkJLlp1yVWVFwaQ/31pcnRBkFfA/UhnhGskzAqCoeV/3kP9GCWjnpSxX7s/wgIdHX yCyIS2Q2g8cMxiZ9b2DNVAT5MWiB402MlAg3iQy3moR2C/CPZw1tNLBOZTLwULjY8fDE cQIjtytpaCNNIFNUW8Vw5AmfrfqqxeA9xWSajeDROXY3h98rkJTa40AbwX1k8Br+ZVcQ IdkA== 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=Gso/ZjhlrgMmhdoQZjP+XmB4VfqX85bUDboSDTCG/i4=; b=bWRiSALBfq/xny0iyHEp4SnErRZCsN6X/V5xgBAODkr1SAbPtjglnnTQkzsomNvhRm uzeHLVbWEtE5jbiMWUVir89NHQKQWov9F18wmzLKS/VGuePKZLgCsXzrauaIUazxbWNk nHlRuZM8iBOl9AodE61MdY08OBwexehXmtdSjzw0lhG4/5sJ2r32Z/BLbRJDg/fAF49M bCn6KhTYectlCy89EEDl/xpRnTXsRWHHhWt06QgLVBf4MXGUDDGFtJlWzx/yCP2858rA ne+Sm2zefLH2dXwS2hDDV73u+UXlzj2Y/HOfsZ/g4z+9JiXcoYt4dHFXTFJAVPAaX6C6 d96A== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oyY5qDzh; 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=Gso/ZjhlrgMmhdoQZjP+XmB4VfqX85bUDboSDTCG/i4=; b=N7sCmwtg6Qe38l3lnkHz5DM1vmjX5BHH+RVlPS5u7gSrpjzHPCBSK6Cw+AKCyAcpJv dcyKm9Nb/wVsRgvwiRfrMSgIpHDdoOBGPBKsBcxlJEwB57uVohQpj87cSL77lRN5yKPs 0d3K0mE/Ku/+Fb1c6FvyIhp5VFhJhySu6RkJo= 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=Gso/ZjhlrgMmhdoQZjP+XmB4VfqX85bUDboSDTCG/i4=; b=yw8wISkqzYV+ME++Wk47yiZWYB+iqfV4bD1PjBwJgeubKJPQf/nKZ6ySj7Kc6S1yCl cPMNtAjJT7b17/Xh55n2mbbbpYAvfBG9uiZMk+HgXmeqEPxoDOaFAmL1kizOusSD9miI oj9REU2WCZoRhAReIFxtnXmMY2DVcpF+2cWI5LP76RSTM6Lifw1gncxD7KObmHCPYXsX bf3HdLG1yIf2bVV6QAJNhibuCMFTCj4inCo9QJEuO6L21UmtH3t/9TknsRtwQUfyhaWP 6fxw7bz8nX/IC0VBoVx1Y5ut+lVbKFAlcfcqZk6XD/84hhzHbtJe5rxmPTiyXblVFpd5 /G8g== X-Gm-Message-State: AOAM530uIgrw7uQDeY5P5vO/xQ+zUenVluVExGmMIq+YtOJq7eJ4BtA/ v5RuIlOx6E2XE76T+Vs/U0ANb6Dc X-Google-Smtp-Source: ABdhPJwwNQlJbF1ipoRctSMtRnFSt861DQZMTHeT5vOjzwZ+qJTqj+YwYWo30ODoxJ2Df7qYcRS03g== X-Received: by 2002:a17:90a:5996:: with SMTP id l22mr5435835pji.27.1642408958909; Mon, 17 Jan 2022 00:42:38 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:7e1c:: with SMTP id z28ls1753661pgc.6.gmail; Mon, 17 Jan 2022 00:42:38 -0800 (PST) X-Received: by 2002:a63:9356:: with SMTP id w22mr18394460pgm.449.1642408958190; Mon, 17 Jan 2022 00:42:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642408958; cv=none; d=google.com; s=arc-20160816; b=YucRwtSerLP494U+9eo4VmGbLw+KlAmHczP/Kh7gej0h/e/6C/U0crchSZX20UFvHK 736PANTFNlG6zLLxwOB0U/6orD5JpWf7ZoDHjpp2F9KIvH4SdZx8NY7CgDONgh6a011D kt/1kOMrjFyRUn1G3PVMvYcTIEjiV+vbhGdUYHa7SeGABy/EqyNMQSR+tMlu3+tPKmSG iXGQ8lhUAo4qu+4t8OnXGM9aQ789kvF04jVCaXX0QuaYlFGYjVjFU13PfLnhTcGFRH+8 4JRv9X6o8864EAtmR/UMot8HsO5aqPo/kmIrqwfkS1RR1WbH8nBmNS+9wjtc6JrWpiak Jj/g== 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=cFhuM499uRgAGVXd0+qvMKKdWgmvOXkveHsKZuQuM3I=; b=jENwXeDCSHo7+MzmTR8NrLYdJspYYFSgk7KQuXws/XLd/szdVtTzo6L8VdCTYvmwlz Sdh2cbruCrplhjkVznyWDxm21psuiMZLvA6bhj4zYRxy5p8O85WS0/sk5uYD8FGQon6x qoxRlzKFDNfv5HgouvGt3oz07owqw8KmAjI0YEIjoyoHxEvW33U/4yomMZ8LozlkyO7I 5PvEANAAy/jILVayub9RkqTxN4almAm797D8ex4mcZxGRx4TihbLnTrWemB3ydArgqui q4elD/Jkzn66UoQ26XgVz68PFIJ75iOdawZy5fD7i13kfI+CFC+pwrncdrMEWsnFyVaT NL1Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oyY5qDzh; 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 a7sor5140811pjo.0.2022.01.17.00.42.38 for (Google Transport Security); Mon, 17 Jan 2022 00:42:38 -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:8804:: with SMTP id s4mr10971030pjn.137.1642408957905; Mon, 17 Jan 2022 00:42:37 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:955a:760d:bbf3:5d4b]) by smtp.gmail.com with ESMTPSA id z3sm11763423pjq.32.2022.01.17.00.42.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 00:42:37 -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 v5 1/5] drm: bridge: panel: Reset the connector state pointer Date: Mon, 17 Jan 2022 14:12:21 +0530 Message-Id: <20220117084225.125868-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220117084225.125868-1-jagan@amarulasolutions.com> References: <20220117084225.125868-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=oyY5qDzh; 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 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; }