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; } From patchwork Mon Jan 17 08:42:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1841 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 963BC3F067 for ; Mon, 17 Jan 2022 09:42:44 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id n23-20020a17090a161700b001b3ea76b406sf13766715pja.5 for ; Mon, 17 Jan 2022 00:42:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642408963; cv=pass; d=google.com; s=arc-20160816; b=CwkJslLQmIN/TsEOQPKBWXNDtH+Skke6gg8MfgPNFeDOGhW0JvonK88XP4IKzrMqIr smoqG/0iBzqgHopBxAzOeveZQWpjFUjW5eCS4fGQLhc6vohks53Hq5BIPB0N1bEpHzhC WttJxakFhcopF6v6m0xaxxrhLGPnoeMLFfsqZ2ctoEIrHJikTz//4wVdCXEWkfPQCgP4 z8aJuD1rjXhMH5h/8eoNdopHj0KR9R+bRnLscK+f+lzWeQEu/I10NVwSDsb+n9wSHAHg wCdZPsBru78U+ByPunGQj9AjV0wRMjVHsO6y07AZ5GeyR9PqadFnQGtiqE+YVgNqjOuo nvsA== 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=ugVgp0BGEBg5DyTtTDb5whnxi4KHlhnGp/NSIDe3k40=; b=Q1bpg1QWTRFElu2bJBoF13+kNOJr4jEsM2pfrEPmuLs8Xf6BwHaAjbMhwoZVVsGtcC Z/ezJ2f01TV6SO4asCUhDCqSW3y3VJvR0bZ9aBelh+zLxqOupdhoXb4iEKNyougXCde1 MGFszGmZK78tNifALnDa79FvuZ0w8ucWRkqyudQ32y9kWdYLEHlbDsIZ18BToo+jS8DO 0JKaJ15fKanF3lPAedJRUzTaKHhDqJbv3DvQk6uAXDRe+aU/EKIa4y6dDF2UlWON6pKi 43pNqR8SLk381Aegc8DI3nMlu6e/CbrDRTGJloMYzLiQtJLsqFHpUzJEqXXX5MbHvafA uYMw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OCWX3MH7; 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=ugVgp0BGEBg5DyTtTDb5whnxi4KHlhnGp/NSIDe3k40=; b=RC7x6x6YUT4za7nMeN7hxLyYg+3+yNCMUqtB4Qebh4YdYwEADgQJq3+yRK6Qy4VJod ZePSC9O7GHGrwRwuTRFWMmySIxixl5UY9e+0+0g2Y4vusxm1arizksn/rxXBlUAUvXof +ApjSoIVY1P21P72SV4mT+uiyUD/0KaI1eRJU= 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=ugVgp0BGEBg5DyTtTDb5whnxi4KHlhnGp/NSIDe3k40=; b=MEr4aB2Qw7eu+WHLhMHHxRiNRWPoHkSi2zz8RyvlMen4z6Nq9SWBkNc1VHKCbmAjti F12rgViOiKzKOaawjULn4f7VQpyPSgN0NyLN0b3xCpz5WZYelMbAN8aRg7pTYWPMrJk6 W5E0ftHghJbFoGRfAQsrO2umzjmzvHBU0tMQt6yR9sjT0J/lqjEzt9ODu/7VzMB1a+sV fNBQOGDJ258cvMwOQ1xDXqtxpD8ebiw4elHsCmLd3C2q4AcWm0p7ECbCKA90JgbOC1P3 YenEMlIwuGO2nMObEsrQ5ENubkOC3m+7IKfTprZdR1FpNbxmZYv+FOIaf2i9j5TmhcPW ENkw== X-Gm-Message-State: AOAM5322NigyngLFNTGZqZvkpHzWTRPcxyFw8MPfvWdjsnVO/6wNijot GjFa3nN7WfzVCKBh4CuPEmY07iju X-Google-Smtp-Source: ABdhPJxJu9na0hf57VN9bnxmdTuiD7UOaMLSv0WSCLwMgXrnVMm18Z0Rq1k6z2vxSJuQSrVWtFr8GQ== X-Received: by 2002:a63:705c:: with SMTP id a28mr17909651pgn.339.1642408963417; Mon, 17 Jan 2022 00:42:43 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:be41:: with SMTP id g1ls4471192pgo.4.gmail; Mon, 17 Jan 2022 00:42:43 -0800 (PST) X-Received: by 2002:aa7:904e:0:b0:4bc:bdd5:f3d with SMTP id n14-20020aa7904e000000b004bcbdd50f3dmr20203564pfo.9.1642408962747; Mon, 17 Jan 2022 00:42:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642408962; cv=none; d=google.com; s=arc-20160816; b=cdi7Hs/FhMguMnolcjHpzP73JY/g98qsn/CBHRldTh/QRzvlS1HHihuDgbjXU3rwAx RhjVcrX0ues8kBu1UM9azXUTKrP+1BWUZqPGsUpmJHLy4xhgmEQaw1Fgh9rfCQHU4Jcs Tbo0zmhIJ13T8AsHYLh9L8z0L4hO2mXLeNdhvIsdUj6GWs7xW2mNmDr5zLYRFx9BTOam mCo7BaPu8cGyj9ytptBO/YLUphAGqdrHzF4iFqChxNghjC2c8spUVMIpjEN7dXDkaigg eG/Q40bgV8QYuDHeQQXapCrYVE0gR8kdv5X5HoaqKWmpPXv8v7SX6k8zFf+Clunlrze7 VUVA== 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=/zfiuuS6N+V6QtdVoRyeHCOQ8xFFFvWB1WtlwywfESc=; b=KsPgsKnU/rUc3Fuv3Kzx09Nyjbl1OfgLVW2AOeYGSpHUNh6sG3ElYPpiUAwyusiQBm WQpmNdr5AQK1sbemOEFnCrT1q0ThW8c5hzVKmFZ49ltOr1Ai81GqrWj8a6fuiVoxDkDw u5rlDbFr6C0glhfSXtUQ2FMO+/ipH+pJWwoWhsJ0aCoqWUOEtfRuJKwIG0dUov4YXzsW mfRubiJTpdt8gmSxv8iY3Uha8EkbfKIP1Gb7HJZ1dyt2VA0GuW7n+QgefVlPy6/paqaS /pCrt0xQCebOoe2Z6pV7e9mm5UJ3UUn1t3NLLlvybS8v4ttP+DDa4FVY8aQb76WSV9qR IgKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=OCWX3MH7; 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 v1sor5974474pjh.26.2022.01.17.00.42.42 for (Google Transport Security); Mon, 17 Jan 2022 00:42:42 -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:33d0:: with SMTP id lk16mr22492164pjb.45.1642408962469; Mon, 17 Jan 2022 00:42:42 -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.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 00:42:42 -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 2/5] drm: exynos: dsi: Use drm panel_bridge API Date: Mon, 17 Jan 2022 14:12:22 +0530 Message-Id: <20220117084225.125868-3-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=OCWX3MH7; 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 v5: - none Changes for v4: - drop unneeded headers Changes for v3: - fix port number - add print for attached device Changes for v2: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 167 ++++-------------------- 1 file changed, 28 insertions(+), 139 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index bce5331ed1e6..ebb19194bb86 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -25,9 +25,7 @@ #include #include -#include #include -#include #include #include #include @@ -221,6 +219,11 @@ enum exynos_dsi_transfer_type { EXYNOS_DSI_RX, }; +enum { + DSI_PORT_IN, + DSI_PORT_OUT +}; + struct exynos_dsi_transfer { struct list_head list; struct completion completed; @@ -254,8 +257,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; @@ -286,7 +287,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) { @@ -1392,42 +1392,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) @@ -1440,15 +1419,12 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; - 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); - drm_panel_unprepare(dsi->panel); list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { if (iter->funcs->post_disable) @@ -1468,70 +1444,6 @@ static void exynos_dsi_mode_set(struct drm_encoder *encoder, drm_mode_copy(&dsi->mode, adjusted_mode); } -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, @@ -1544,33 +1456,23 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct exynos_dsi *dsi = host_to_dsi(host); + struct device *dev = dsi->dev; 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; - } + int ret; - 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; + dsi->out_bridge = devm_drm_of_get_bridge(dev, dev->of_node, DSI_PORT_OUT, 0); + if (IS_ERR(dsi->out_bridge)) { + ret = PTR_ERR(dsi->out_bridge); + DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret); + return ret; } + DRM_DEV_INFO(dev, "Attached %s device\n", device->name); + + 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. * @@ -1578,7 +1480,7 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, * TE interrupt handler. */ if (!(device->mode_flags & MIPI_DSI_MODE_VIDEO)) { - int ret = exynos_dsi_register_te_irq(dsi, &device->dev); + ret = exynos_dsi_register_te_irq(dsi, &device->dev); if (ret) return ret; } @@ -1605,18 +1507,10 @@ 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); + dsi->out_bridge = NULL; + INIT_LIST_HEAD(&dsi->bridge_chain); if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); @@ -1672,11 +1566,6 @@ static int exynos_dsi_of_read_u32(const struct device_node *np, return ret; } -enum { - DSI_PORT_IN, - DSI_PORT_OUT -}; - static int exynos_dsi_parse_dt(struct exynos_dsi *dsi) { struct device *dev = dsi->dev; From patchwork Mon Jan 17 08:42:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1842 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f197.google.com (mail-pf1-f197.google.com [209.85.210.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 41EA33F067 for ; Mon, 17 Jan 2022 09:42:49 +0100 (CET) Received: by mail-pf1-f197.google.com with SMTP id n203-20020a628fd4000000b004be3d8ec115sf5853960pfd.0 for ; Mon, 17 Jan 2022 00:42:49 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642408968; cv=pass; d=google.com; s=arc-20160816; b=Kvw4q96UQuXKOg2PBdZ+y5Os8oIdKz5cLMtOfEFuYcL+zXVtagioo9mYqYViawia/6 pnLHRmFVhtaxzLwm7EG3+1vM3a910bw1GtkiGxyNSrRLn0kfr/CLR72x84lVuAPvoZeK s+gvwV1heb2la3ENQmmS6cbPG4YIhPKlPlOFX7E6ImN37o/uOCojuu85810tPw1xsfV+ 0DmpmpvggyOdjmKzVE437b0mwhPTfLUgiHLonvtDuz6i8epxlBK29hT8NHqaHrBgsrjG U37nU01duXJmG+reteaWmtVWOUpu1vNMRjG1CavhZMGPFVvvSGWTD8v5i+ChDDMZOR82 QxCA== 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=joXlxJttfQRSoiskrZxO8QliZ9bthSdv4T6pxThyIA0=; b=cfFUhYkDUT09ZDywacxoC5Jx1Z+LoPoJwKhAYNOkAHZLzR7goynQzXmNVNsz32GrWf rNb3xOH9Up+OgiWbnBF2+EkTwf8DLFsCPWN/lktCpck+J6l34rxfPZUHjaK5LUZv2dn5 8PIgHIgHTkIXQ60seEU68xsJuXCMHBpa/OP73iDKd/bcI3yQYOELVtXC/JCJ/XH0PTbq I0NHjZOPZTntFXzp4kAkgZ+CtOou+ZsgpZfhu6dEOj7RktOejkNg+7Cs2DWKDcYRRa+V idlTPvxhfZdkZ6E1x49jjezoAi+tC4bPeu47LZJDLsw8ZXUQlwjtkCxwQXQAhuficwWv +Qqg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NG3UQCY9; 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=joXlxJttfQRSoiskrZxO8QliZ9bthSdv4T6pxThyIA0=; b=evZdJy57HGh4I+uiXmO58BzHpxsiBjlo8I3mxm8RctbO6K+KsI1XTxXT6exc50ynxD T/HLp9fFCN3o77ddcA6t9vY0Ag7qL8twdqXyRp+sN0sapbQppO1DPH6ySacIYydWscEf 1+hE+CcAmdZnNb2TkHNaDxZ8Y7aEpX3XEKKPc= 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=joXlxJttfQRSoiskrZxO8QliZ9bthSdv4T6pxThyIA0=; b=dup9xoWPldfq1k+Q97zvKJJGnpCTV/coywyef3YqPryaMCWzQZ4dBSVmhyk67jFDB2 Fw1oxQGFo/XtRx3K7Z2sASTTBNNvj7QfT8yfFPwMWOZD7aRXwGYpGPjYO2LkQWC6sqFW gkxQfqrCwV6W0ywwCk4ahLMY8jT4PiinC/0JQBnR6fnBNuFfY+VVQHwh8mm1v2X6eDku lilNfSDPLC6A5jTUCdVGs9EGFuO8t8q9rxQeFueendi7TuaRvKBDrgVsBM6WvGMRjlsy YqauIGtcrp1Cs0i5NxqYl2dCrsf1xrGdjsvVZvnRUSK9BtCayPvm/UGwKg71FOhIfRfo UWfg== X-Gm-Message-State: AOAM532xnuqUW6EKPeFWNsf1NwEMhSh/r/hUEvcnaQPS/5edbW5KbvSQ 5endij6pMaXW2I3YN1bAMwapegeJ X-Google-Smtp-Source: ABdhPJwwyGNAC3zNkIgTGUYsdyqWqbyL41WxJ4IxtsukioXEupq/qFP/7t7vf2NtU+L9myiLYkcHfg== X-Received: by 2002:aa7:80cf:0:b0:4bc:ecc1:e7f5 with SMTP id a15-20020aa780cf000000b004bcecc1e7f5mr20426036pfn.11.1642408968042; Mon, 17 Jan 2022 00:42:48 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a94:: with SMTP id b20ls6031654pfl.9.gmail; Mon, 17 Jan 2022 00:42:47 -0800 (PST) X-Received: by 2002:aa7:9e10:0:b0:4be:d337:45ca with SMTP id y16-20020aa79e10000000b004bed33745camr20219588pfq.21.1642408967417; Mon, 17 Jan 2022 00:42:47 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642408967; cv=none; d=google.com; s=arc-20160816; b=CIx2OSKiVY5WVKeyaq1sTurOonXe8MEdtQBdnM+imn2AvWqZET8+dPd+1JgdrPhDt+ inxGLKPK2qTedCDbQTeypPWlcOopPNuzkWGYHZMK0wb+Jfa/cTkEqHk3BT3BLUCKVGzo 9qQbAU4z/4qTULERYG6ZZOuslC74P3ENX44MzAM9R5kUKImrt7SVGqFTnr0J0eC6Wbhf xzT5i9eIi4U9munPJT0wbtjdEXsUnWxi6mDkHcZYCxGFyUsAKp+tPA7Rx5Ot2EhoQV6I LltwmJVlu7z6jkx8Ix3JQ2SU7flZC4IeaD3OT9jwrC8K3a/qzuFG4SHFJsZp79XGqoTt U6hw== 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=lu7N54hDgGGVeugilU9YpEcDIXXB4MJdT5H56dpnQUM=; b=VIAoDxoeOuN4aP5Zi2vsT3aY6zn2o7O5BQTj7ASNWHj5TyZ7EP/NvLZIbDLLSHSvFP lu10JE9rKoO2KdZjHKQmjClKulCz3PVjpJXfOsPW6AjSlsp6VKicX5mVzyX4Sh5B003G Awj7D5bQ7UIHVl5vWU90nuuZh0s+yX8+4B5K8QikJbYB/JT5MBTtkwUvYkiKNl+64PQA 1N+Vkq5F3UD56ynnikjX+KoEQQOIUqh3vnrrahau6Z4ofQHMxMmlm6Ai8paLABr3x5JS wlsolerNffTzuiyhaadtz9CW8c9ZS4DNu8zCqdITiaAuNIIpMWve7pgA/WHYIqiDcFna xLnA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=NG3UQCY9; 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 lw16sor1778413pjb.28.2022.01.17.00.42.47 for (Google Transport Security); Mon, 17 Jan 2022 00:42: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:a17:90a:b701:: with SMTP id l1mr12422181pjr.153.1642408967021; Mon, 17 Jan 2022 00:42:47 -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.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 00:42: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 v5 3/5] drm: exynos: dsi: Convert to bridge driver Date: Mon, 17 Jan 2022 14:12:23 +0530 Message-Id: <20220117084225.125868-4-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=NG3UQCY9; 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. - Adds drm_bridge_funcs and register a drm bridge. - Drops bridge_chain. - Separate pre_enable from enable function. - Separate post_disable from disable function. Convert it. Signed-off-by: Jagan Teki --- Changes for v5: - none Changes for v4: - add pre_enable function - add post_disable function Changes for v3: - move bridge add in host_attach - move bridge remove in host_detach - use flags, bridge in drm_bridge_attach in attch Changes for v2: - drop bridge_chain drivers/gpu/drm/exynos/exynos_drm_dsi.c | 88 +++++++++++++------------ 1 file changed, 45 insertions(+), 43 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index ebb19194bb86..8ca95c72ef18 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -257,7 +257,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; struct drm_display_mode mode; @@ -288,9 +288,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 { @@ -1375,10 +1375,9 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_enable(struct drm_encoder *encoder) +static void exynos_dsi_pre_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); int ret; if (dsi->state & DSIM_STATE_ENABLED) @@ -1391,63 +1390,64 @@ 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); - } +static void exynos_dsi_enable(struct drm_bridge *bridge) +{ + struct exynos_dsi *dsi = bridge_to_dsi(bridge); exynos_dsi_set_display_mode(dsi); 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); - } - 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); 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); - } +static void exynos_dsi_post_disable(struct drm_bridge *bridge) +{ + struct exynos_dsi *dsi = bridge_to_dsi(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); - } - dsi->state &= ~DSIM_STATE_ENABLED; pm_runtime_put_sync(dsi->dev); } -static void exynos_dsi_mode_set(struct drm_encoder *encoder, - struct drm_display_mode *mode, - struct drm_display_mode *adjusted_mode) +static void exynos_dsi_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) { - struct exynos_dsi *dsi = encoder_to_dsi(encoder); + struct exynos_dsi *dsi = bridge_to_dsi(bridge); drm_mode_copy(&dsi->mode, adjusted_mode); } -static const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, - .mode_set = exynos_dsi_mode_set, +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, flags); +} + +static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { + .pre_enable = exynos_dsi_pre_enable, + .enable = exynos_dsi_enable, + .disable = exynos_dsi_disable, + .post_disable = exynos_dsi_post_disable, + .mode_set = exynos_dsi_mode_set, + .attach = exynos_dsi_attach, }; MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); @@ -1470,8 +1470,9 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, DRM_DEV_INFO(dev, "Attached %s device\n", device->name); - drm_bridge_attach(encoder, dsi->out_bridge, NULL, 0); - list_splice_init(&encoder->bridge_chain, &dsi->bridge_chain); + drm_bridge_add(&dsi->bridge); + + drm_bridge_attach(encoder, &dsi->bridge, NULL, 0); /* * This is a temporary solution and should be made by more generic way. @@ -1510,13 +1511,14 @@ 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); dsi->out_bridge = NULL; - INIT_LIST_HEAD(&dsi->bridge_chain); if (drm->mode_config.poll_enabled) drm_kms_helper_hotplug_event(drm); exynos_dsi_unregister_te_irq(dsi); + drm_bridge_remove(&dsi->bridge); + return 0; } @@ -1602,8 +1604,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; @@ -1623,9 +1623,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); } @@ -1651,7 +1650,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; @@ -1719,6 +1717,10 @@ 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; + ret = component_add(dev, &exynos_dsi_component_ops); if (ret) goto err_disable_runtime; From patchwork Mon Jan 17 08:42:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1843 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 B16CA3F067 for ; Mon, 17 Jan 2022 09:42:53 +0100 (CET) Received: by mail-pj1-f69.google.com with SMTP id x14-20020a17090a8a8e00b001b3b14c53afsf14366413pjn.6 for ; Mon, 17 Jan 2022 00:42:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642408972; cv=pass; d=google.com; s=arc-20160816; b=ieQ6MYLkJUqO9U7n3d9cmikjlp/rRjL/51w+C4rVT5VtEWSKHJa2og1MuuOjm4aGp7 1JHH9HFdRTg3NQqiLvrOGSB5S6acqbwfyv679jqIyH8o/Fmo7b1TB2zkj7URk5ychwi8 wWdl1Yo8u5/U61gnFz/Ys4TJdbP4LfBzZ0VHfXdl0P9IcvYziHDtqbyXQm4mQ47tMMPd sEx/kXDwUrGRSAXefeuMA7zq8cqnx4FbGqKjX1/10wx55IFiZ1zxgpHcZkDUQYKNtNuu fBUPkcURdZYjKXlgkxAm9LrycCSQF/Q8pBlQw2h5+Lu+ouuR8PPV0MB+MH/VSCzs4LvR Sg8g== 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=UZ2Us7xSevoPewXAICGGSlggGmfX4/Ud8PWXrNe+whY=; b=zIx518wAkInHwzilIemcs3RnpFPRBFc+me/9TEd8cqmaEq+h0JuQ8+UbDzRs6nBJjt S+qT1HKYklXCGTLM0CpurDWXWbx+3UJGrjwHj+aJ3bKl0USpXmjrjbrkgqfDbGbwLMsg Bu++28rOhL8Y7Zv0F7WxLSGKDdLWc9uiD4OIc3gO8dM/rAQoChhK4kJPGz3AapmFnMML wjEZGMgtVYbfUBYP4HihGnABqe7NxnoYKCA3z12vjh5vOyxxDW4QpGQxfhzP4n2TPI77 amANnXY3jcu26/mLL/lwSEMGV1DdkNOytFVN2ALAcLvpX5he04cGyRl1N41AEsdyn58y R3Gg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Q4hm+8My; 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=UZ2Us7xSevoPewXAICGGSlggGmfX4/Ud8PWXrNe+whY=; b=Z8EWUKIJ3CXrhHgwPtZndsN6CjIgCGPhGrfJ6RmF46AE/vct10mokFvgOQg6N4rip8 UNhx8cTc4RnfohHwsnrzK0yDWeRpJE6UQTIegbTsRimbmxQN/VWD5MQiG0jQGIlnhS0R 4btHh51z9M4uUvVPuWIYWsZa09F8L4jYUu1A0= 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=UZ2Us7xSevoPewXAICGGSlggGmfX4/Ud8PWXrNe+whY=; b=WgKbt7bKbjPx0kFJQc2Xk/4Zbgc3ol3puTgXasqcvhnPvtNKtogcroPXgu5oBRFvkU TAP3DqYC0FMhwaDmLy0pLZ8nxfyaTjErW/SdbxhGbXiFNgbq8PcQPCsipOQ7DLXr8VSM KZci9jHL6vdPvAYx854SAMAxRAZ/pNhMqM5Cz/fq4uxBqdFPsWY+vqeQKXcoMoYyEc3S XOi0VHJFY+FsRI7do5iSiIXNtULbJdoyw+CDwRFMAtFR/ZjCML9J3X7uEH2BH6+kiXV7 kmB3rGLTO/oLEOp2R4xPPZsHb75a/RGQQ5dyLNUx2AVxJVsVhWxbM6T9BGp7YZ8Iiu+Z UpbQ== X-Gm-Message-State: AOAM532vhcgZczMYPabR+ih5WtGH0VYb6I6MuHtxhQfXC4IJzKlR30kg sKwlp6ongxKg8SO481PrmbU8Mxkz X-Google-Smtp-Source: ABdhPJwNerRBmH9mxUFhSZthZqbm6kNzpUGtRbcSejpQU1Mi9B3XicMnOZN92Ndq+A8h040EpYi0ng== X-Received: by 2002:a63:2c81:: with SMTP id s123mr18276669pgs.511.1642408972520; Mon, 17 Jan 2022 00:42:52 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:5c1b:: with SMTP id q27ls4474632pgb.3.gmail; Mon, 17 Jan 2022 00:42:52 -0800 (PST) X-Received: by 2002:a63:5607:: with SMTP id k7mr15305596pgb.190.1642408971836; Mon, 17 Jan 2022 00:42:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642408971; cv=none; d=google.com; s=arc-20160816; b=xd2hCWUY7u2z8KRe+9o9H/iKI342cVdnnDWHC3LDobp/hcmIBdz4mmibzumB1HK08+ MMn5hKhqS/sRXlaxFqDcveYGJ6YqIqrPz36BBc40sCj1ZRMXlss/FGUh++OUWN2I0SCV 1QUSwfjrUJq/0qkfsyLVEpwajKBr/tj/RVZyQRbCqRB+B/Id8ImtZrHkBvkWOjvIqqLe 4bHzqxRKvGDssZYze4cjMSj2XMXD7dM4LH6ShdwUDlHvoGlXPNGuoWyj06RbP/UjOuST Qemt7JVaQj4PnF5mpYFCAzTC3uhMSCZvx9h0E2O8HoCKTi2q5WsfvBpRlQ0l9x+jZs7J xptw== 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=IhmCFvkAszHgt3WyWtiQC+FGRY8uffNwxLOd3YDOkC8=; b=lgwUa6MiKpG3B3I7+6ON2/VbZ3d4nFsVULaRiS1HqfsW2jvaZzAB4E5g2gqJtBL8FS uDuffZpQJBMaz9uehAYUmp8MybVm5pLtR1M+5z7vFfIVSVVKCICrKfyNeIF0Flj0+gdI Yb5GoEDSIvhLg/V6E2eDN1CbTJKO1E3NYkdngzw2uhFI14z+bPspTr8kOEdGKYi3mJYR zpNTHTPg1ko/y9Pi/AN4rDtk43pMhS1GkSZ9Kj7vFKImE6XP5Se/8zfr0TQxLYh/BEKS XsXBAy+3atA9pXpqheiH/Ptt5fmVydQbtVfCEg+Vo127S42z8rwpQkRiZlJTsZXXkTwh uoMw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Q4hm+8My; 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 c15sor7535620pfl.15.2022.01.17.00.42.51 for (Google Transport Security); Mon, 17 Jan 2022 00:42:51 -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:7543:: with SMTP id f3mr18191438pgn.360.1642408971597; Mon, 17 Jan 2022 00:42:51 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 00:42:51 -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 4/5] drm: exynos: dsi: Switch to atomic funcs Date: Mon, 17 Jan 2022 14:12:24 +0530 Message-Id: <20220117084225.125868-5-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=Q4hm+8My; 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 v5, v4, v3: - none drivers/gpu/drm/exynos/exynos_drm_dsi.c | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 8ca95c72ef18..891b5c984f0c 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1375,7 +1375,8 @@ static void exynos_dsi_unregister_te_irq(struct exynos_dsi *dsi) } } -static void exynos_dsi_pre_enable(struct drm_bridge *bridge) +static void exynos_dsi_atomic_pre_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); int ret; @@ -1392,7 +1393,8 @@ static void exynos_dsi_pre_enable(struct drm_bridge *bridge) dsi->state |= DSIM_STATE_ENABLED; } -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); @@ -1404,7 +1406,8 @@ static void exynos_dsi_enable(struct drm_bridge *bridge) 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); @@ -1414,7 +1417,8 @@ static void exynos_dsi_disable(struct drm_bridge *bridge) dsi->state &= ~DSIM_STATE_VIDOUT_AVAILABLE; } -static void exynos_dsi_post_disable(struct drm_bridge *bridge) +static void exynos_dsi_atomic_post_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { struct exynos_dsi *dsi = bridge_to_dsi(bridge); @@ -1442,10 +1446,13 @@ static int exynos_dsi_attach(struct drm_bridge *bridge, } static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { - .pre_enable = exynos_dsi_pre_enable, - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, - .post_disable = exynos_dsi_post_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_pre_enable = exynos_dsi_atomic_pre_enable, + .atomic_enable = exynos_dsi_atomic_enable, + .atomic_disable = exynos_dsi_atomic_disable, + .atomic_post_disable = exynos_dsi_atomic_post_disable, .mode_set = exynos_dsi_mode_set, .attach = exynos_dsi_attach, }; @@ -1624,7 +1631,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); } From patchwork Mon Jan 17 08:42:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1844 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 6ED733F067 for ; Mon, 17 Jan 2022 09:42:58 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id ij17-20020a17090af81100b001b498904910sf868243pjb.5 for ; Mon, 17 Jan 2022 00:42:58 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1642408977; cv=pass; d=google.com; s=arc-20160816; b=FjJW4ivTOViCwi2CUxZ0KXr7xRn3e90UtRAQoc9y206e1ctrh8FTixobgAs0UiPAZQ kmfwWOOfn/PwZ9ZFk1P7VwVPxNlJcIaFAxVjjqEf+ok99pIB0zKucK22jus6r7HXwHcC L1TWs7AUcsaJzqOiI+UBuAfGT7KIc80w3TwMnQf8fBCRbLmDQa1rZ/mFJClYafRne70j dXOyDXRCtWYEImx1cy9AYqUi8l1ATk0K9Do7SKl2lg+6GN79sRxS0VB49Vx4xc8+NUD9 zk/s16XNfCGjFG5CfkqWyI+jVnnTk0oMhsDds8Zc0Kx8sbwM8ZlRg9zy1Nlyc/dzndsv 7e/A== 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=qnYuZzozT5eEGrue6FC0o6JsPLAHQ3gnedPbjPzlmts=; b=LcohqXlFXs4YTCUPAlvtUhhwQyqi09z18He5bcuugmxWYKhx9PZdIv8AAsfvawu8de mD5uLaYhQNq9VmhHgNzLlczT+kj+xaiWjCn0adZR5I3ApJz/6Y/L2HhZObDEhNt/fFuP 6fVffjcueR3dkn5z8jJTwOh8ZlDnE+YRmfv06F1JkWgxBy55GbKE7LhunE3OhWI43JKk fvXz4EiibjhYBs0EoeCkg/4I8Oqalk7crws6vpipE9hpL8Pk42Z+nYmGtnxcJeOSTYBS zYJfwnOOHup92i+645H+ivb0cTr/RgJfjx6DC0C/K2si6uQGcVONT28zDXaX18tg8flK QRvA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o4hBzWZm; 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=qnYuZzozT5eEGrue6FC0o6JsPLAHQ3gnedPbjPzlmts=; b=CpmDE8pQLZaAi4r1abpZm7ERq17+sVooXghJ2Mdrr8o6zugh1TwgrF0xRt0OLwI1lc qXQVHmEIvSV3SiYOiJV1w5hu8S9rXaYzDVpkjPKddysBuTKZduncPZkGfri4eUEUIG5G qYQtCBdZMZTsNKtWSjUo1kVcliySnIhp15XhE= 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=qnYuZzozT5eEGrue6FC0o6JsPLAHQ3gnedPbjPzlmts=; b=5wzVd5HKqjgq1hqRedVLD8b7D5uj5Vmro8DqMofT/AzFg5181VLwKM3HsVBKnf9hTL wMN9NU486L80i0KOE7RZc6RtKKybg+zIkDOHcc5so4X99lY/FrowFUuNHThRN1mfH15Z U9ugGRlnRaIqnos5dwGrflaZynO4jKJl+LO5+LmamfE98rXcnPYrEZ49Pcm2kJae9HpL xn4Y576Hn5I5OP59IbEPyTm7Y7UpTL2428T2uT3sHEm8f0obRPgqFGHONgdltpOY+13a KSSNaaWyjh1oEDxDJMPVfEOjosB+iYe4lgpbFGD+dzNw4e5TBaO9ATjnf/amRw3dmL9F GCjw== X-Gm-Message-State: AOAM533kFvey1HE0nGk6imGeMoIPmn546jONEWsZi2iIPVhjn3uNo9/I a2117X30SQutS6fYtC2xzEJLYN3p X-Google-Smtp-Source: ABdhPJwwclt9vyfYpQOdXeRgokjuefSymOlmbSOzG2mt/k7RWrn5cTI5Vsi9sblrHtHHZhrR8rxTjw== X-Received: by 2002:a17:90a:348c:: with SMTP id p12mr33040340pjb.90.1642408977235; Mon, 17 Jan 2022 00:42:57 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f68a:: with SMTP id l10ls9776299plg.11.gmail; Mon, 17 Jan 2022 00:42:56 -0800 (PST) X-Received: by 2002:a17:90b:180d:: with SMTP id lw13mr20649408pjb.215.1642408976527; Mon, 17 Jan 2022 00:42:56 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1642408976; cv=none; d=google.com; s=arc-20160816; b=tf5mu9tPGKfF0ShxhIV0arXHFWbmJs0x3jFEE8Z57fAl3ewLK3apTDv97PXa7ZSHms qjvaeNOtxdH4GQpOkk1gqzskaGQcrh5IJFpfI4fSFy3SkrqFPKd22bEBSmb/yYgKNja1 DVll8c+EBpeuWJHiBPx8UZghbKtlW14wsj+LaEgZ1m/5srZON27ogk9nHnIVNregP9Nh SEPWsTwW+Qlae9yrF0nq9kvlFLAOnlI0bzOsVFa7IoOwvJphGiIpusR4zROmfy6AZBx/ JbgrM7KNOPLwNiBjOOm4UTnJ70uuZFdPc3brcNhTOrM7biiuxHYbFZHKaAmsvtm48mYV mahA== 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=aLlYG57QFItoYuZcxPFo4KFDVccBN9d8QTsSjRhhKIQ=; b=tB2YVSl44hsdbPuo8m/2sbqUuL2wCMjDFK5AomBVhc8d5PIE6/HZY6dEWamqAoz3a1 TR8uC19nB5Nw0rXn8EccvKFsirQ8rY3Zx+6cf2xluKNo1Wu8HcHvP8L+bbJn4bxznQIU pB6zdlCB93IEyCHe1bLqTP5lR5pitvkk3R+5wt1vyV2Vd9ZWAfZONChLiBTGIklPIzaG +pTAhFLQLjUA7i7RbZNFzUuprY0kFaI3+zKOmwAjnXTTuwdsfzA4So9iKbYJZTlT1zGN AvStG7n436IV2SUGVyPAHh4YMNjIcRrBk/hv3k7BtlnEz0jdKn/0aiAuO4aCdjccV8Dr wd+Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o4hBzWZm; 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 ng16sor2366216pjb.2.2022.01.17.00.42.56 for (Google Transport Security); Mon, 17 Jan 2022 00:42:56 -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:3ec4:: with SMTP id rm4mr4135719pjb.120.1642408976214; Mon, 17 Jan 2022 00:42:56 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 17 Jan 2022 00:42:55 -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 5/5] drm: exynos: dsi: Move DSI init in bridge pre_enable Date: Mon, 17 Jan 2022 14:12:25 +0530 Message-Id: <20220117084225.125868-6-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=o4hBzWZm; 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: , Host transfer in DSI master will invoke only when the DSI commands sent from DSI devices like DSI Panel or DSI bridges and this host transfer wouldn't invoke I2C based DSI bridge drivers. Handling DSI host initialization in transfer calls might miss the controller setup for I2C configured DSI bridges. So, move the DSI initialization from transfer to bridge pre_enable as the bridge enable API as it is common across all classes of DSI device drivers. Signed-off-by: Jagan Teki --- Changes for v5: - init dsi in pre_enable Changes for v4: - none Changes for v3: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 891b5c984f0c..1c3633f9982d 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1391,6 +1391,13 @@ static void exynos_dsi_atomic_pre_enable(struct drm_bridge *bridge, } dsi->state |= DSIM_STATE_ENABLED; + + if (!(dsi->state & DSIM_STATE_INITIALIZED)) { + ret = exynos_dsi_init(dsi); + if (ret) + return; + dsi->state |= DSIM_STATE_INITIALIZED; + } } static void exynos_dsi_atomic_enable(struct drm_bridge *bridge, @@ -1539,13 +1546,6 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host, if (!(dsi->state & DSIM_STATE_ENABLED)) return -EINVAL; - if (!(dsi->state & DSIM_STATE_INITIALIZED)) { - ret = exynos_dsi_init(dsi); - if (ret) - return ret; - dsi->state |= DSIM_STATE_INITIALIZED; - } - ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0) return ret;