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; } From patchwork Wed Dec 15 10:15:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1828 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 1AB413F18E for ; Wed, 15 Dec 2021 11:15:53 +0100 (CET) Received: by mail-pf1-f197.google.com with SMTP id q82-20020a627555000000b004a4f8cadb6fsf13327381pfc.20 for ; Wed, 15 Dec 2021 02:15:53 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563352; cv=pass; d=google.com; s=arc-20160816; b=C3O/e7Ov26o9roiQkWl3y6iXQWzaoj8rUc3Ad9xtA6NYvTC94+4L+hWO4sgxs6qn0p YTdBafuGR+YjHag/Jp2/GJpWhjQ9f+mJ/WqyAT0rOAu/xLcm5FdrcD050gXpyIAiof7P xSIk16KtcfMXZ3mzZjHGc8LMs9ooL4+dN+jv2bX+kxdbOuFQULf+s9dP+55eelvJLzcN 2gB5e8ff885X7UoZ/7ceAKx7LvCK8RqZ1Z+pqlG3aL+j+KXSO5LFvQKPPh54fDVQfGq/ evpU3lmW1m0w/Ej5GVI+wgkpV8tSutjCMTHQEyc75SytbXRDYolGMKI2esCQZhzCMFF9 /3gg== 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=YuL5nN76Bsm9xS2I+sb5qyqb0r1sd8MAihN789YGshs=; b=m/+5Sg7q5HaUoka4DleUT4Sl6otx+D29xNjKr8KfT+NmXvIti/8gEm5KAEUHQh+McQ KjitatuATR8PaMGCjjnAOShzRsiNCFhVX4/SW9hPoKi5qRSmYN/iUHLEWpbilrf6n2/m lJWVA91hYA9Vj40ZDhjg0wKOHNZ6Ek2NhgEnAensLo+GdQpoG1NbOgnWG21X/04A5zc6 2qV5JVcp8Q2ccEUxheNnrQBOCERnoz7MdE63jYUVL1f8vA3AGmB1M3dPRqJk+sIR2sHk bTwPp30hh758cIDie8rW9q7Ik0Vn4gJMNt1m/mRdGmZs40Od3vcpqHv64RXeooA6Aj8K DADQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h2E5KmgP; 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=YuL5nN76Bsm9xS2I+sb5qyqb0r1sd8MAihN789YGshs=; b=WGI/aKa5jd+l1iN1wpkIwA16ae3JDEnBS9H7Xg8N9aQsq82YOI5PykB80oMAuf3az7 e/z3zR+q1LmJkOPT7tuLJLslx9haC9wOrlML9Yx995Aj0ybOB+VNadYqo8JzfeLfSJ3A CDp5zrRY2t26FZLIJnF73es44MFvU1JD3TQMg= 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=YuL5nN76Bsm9xS2I+sb5qyqb0r1sd8MAihN789YGshs=; b=j0e8Chzbi2+KbxBzCrtiklcfP2d1+qMEgk0lGdw6GdDUQDW3yB9s6KIXOqG/tBcgs8 z8YXqu2fYAb8qcbSMfVblzXA3Xcr7N83fTINDOGVMCg422egricSgSTnoZAGNjraZAqk vP5igLiOHxctmg/fIjSXMkVxk5bXITfclZ8jTQrKUfbrBXt7qwpE+eBkjkog2LjsrJ4s oFjLI+eU2Z+MQQtyT5TN209qCuzUfdKdn3J3oJqti9Nq+LSykpG3oBHQtEA7AQICvjll fVF2a4BCqjJ5T5ydZM2/iAF+5ZWIcKdcJsKVubQMyq6YuVocVXaVn1udgsPVMDQr9Qeq g6RA== X-Gm-Message-State: AOAM5323v2oVw6fVzpOrPF2mH/g6qtaT79lLcvAuvysyVsL69V3oJl70 LcPLhpgFPrltsv90nlkkFVk95YVz X-Google-Smtp-Source: ABdhPJzNyq8+EQjpJTSrKc8wcbGAbLQuL1RDNYnm1neZXNVWLjgLPwCzPHXobAQ73wW7nkucjVkTcw== X-Received: by 2002:a17:902:eccb:b0:148:a3f4:1ec5 with SMTP id a11-20020a170902eccb00b00148a3f41ec5mr3240436plh.123.1639563351871; Wed, 15 Dec 2021 02:15:51 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f20c:: with SMTP id m12ls1208672plc.3.gmail; Wed, 15 Dec 2021 02:15:51 -0800 (PST) X-Received: by 2002:a17:902:ee95:b0:148:a2f7:9d80 with SMTP id a21-20020a170902ee9500b00148a2f79d80mr3590085pld.159.1639563351118; Wed, 15 Dec 2021 02:15:51 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563351; cv=none; d=google.com; s=arc-20160816; b=vcvBYXdlF1IB8JBrhSQ6vIv2yuLP8bdXDRsECY90Ot4jr+ye5bDtfazr8YsfGLl/Qz OEmrpcmpGQWIGoSxe0NXRpIVumN+t2REVpGQIW7K9bJwzZ71Ga/j74czRswneBvcfN+j wSB7IZtCxzriJ60p0A6+DKiyiiWSsw2NQaqMNvvb5Q3N/dEWu6Yw/4V6o1cxKxMCB0tO +YPiWU7CIDIVtpfrbqQXtNHKVnHovNEBBT4pSDg9pPzuYtM8rNCAZLhqq5mFRbIi74uT T2K+oaHpvdkdmcdrhpPi48kaU/a5aW7vqxIvJ15R/+/qtaJtFDp9F+W09BvPKFh0yoFe 1u5A== 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=tASggvKbD+8kubIbPYJcEas91o6vPtNnVuuBr/gmYOg=; b=rUo6A62ubg0xn36mZ8SERnnJACHKxW9dV2x8+kngdfqXkvtU9D7uxRG/9v3QFBSnuf jXOQW1GGttyxT7HB9KzpZa9N7GHR74XhZS5j6SJ5vKV8K+BAQhkTW9fCrqWz3cOy1D12 iJUBkiGJKsOH07VyVecDh+a5vxEd5ueRqr0uDvmvBchvgfi7sfdjopNDicbADa6DJKFm 2tzFnvaKOXoKlf3V4VDjH6BlB/2dKRdOFLjonwoNM53kyStHyxuA0YeSSfKcM+frC52S P7Nbo4ndxUyrRbexdVvTB/C5t4uAbUuRFRnUX5C1vd5Pg1Imlu1vSfvXe7U/6LbGl3Kw pVOA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h2E5KmgP; 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 15sor719973pgs.33.2021.12.15.02.15.51 for (Google Transport Security); Wed, 15 Dec 2021 02:15: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:6b81:: with SMTP id g123mr7548179pgc.140.1639563350772; Wed, 15 Dec 2021 02:15:50 -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.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:15:50 -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 2/6] drm: exynos: dsi: Use drm panel_bridge API Date: Wed, 15 Dec 2021 15:45:30 +0530 Message-Id: <20211215101534.45003-3-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=h2E5KmgP; 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 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 8d137857818c..14e16f2d594b 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; @@ -285,7 +286,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) { @@ -1391,42 +1391,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) @@ -1439,15 +1418,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) @@ -1458,70 +1434,6 @@ static void exynos_dsi_disable(struct drm_encoder *encoder) pm_runtime_put_sync(dsi->dev); } -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, @@ -1533,33 +1445,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. * @@ -1567,7 +1469,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; } @@ -1594,18 +1496,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); @@ -1661,11 +1555,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 Wed Dec 15 10:15:31 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1829 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9BCD53F18E for ; Wed, 15 Dec 2021 11:15:56 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id u4-20020a63ef04000000b0033ab2693122sf6572718pgh.3 for ; Wed, 15 Dec 2021 02:15:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563355; cv=pass; d=google.com; s=arc-20160816; b=b2cBIzFAsArn0pQpwUyEMqYWnFh45cppUEuVvvHtfUVsWo//3JmSOJ2xBIA9I2H5mM zCIo2pZ6c+l3DAeST296Zt3bpgTliiluFLdMTQALB7+0DPTYf+/h5FIbcLALKg5kUj5B Ku71q8dAYmuP3K1XNqXQnVDidOeh5jX6Iqar71tucFZ1cPyvmXtIwLWVOrLFRlvtJmIY xQdIQsBgY6q+aDc841j0BhQhqEsRATX68GCOWLGf3RLUEOzUHRE7vH+90gjpwRc1ZEzA woI9YRWX3RfIdW7/nbh2ipLdSZhxrFeexrXp848Y7Jkj6txDpqQnx6tFPBRk6INjTo6X SYoQ== 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=EPanpM5WK/I5KI3lF5R2dqhqi1fzJ52IZbKFHZZJIMU=; b=r6/xweloEXO44/s5uTkNIGHJG1aqhu510RLLoelYVANo77+GV156MQS0BoD51uUtdx 5PRJniJNB0xX4BTEcbYEPunQGMmsJuuDQDaVIrGH1CGWxryqfXpk/+zHOu6Zs4tfcFXT 7wm8+yPl1JWzwhGfrXgTY8Q9haQp+Sk29FWtmNUjU6/Z/40sMH3Skx0jM8ejm3ocWzWN cAa9bPchY3sGBI5kjPV/52EfbRqcBJwg11icVwzVvdkTFa9btRhKu8kHj7IkHw8AkuUf C5RJkiqZo+9Zjv1dBlPTm5JslSUnRGGO+o0zx9F9QgEvDwamIqht/O0rgDROCwNfpYRQ 5ofw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FkFA+o0I; 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=EPanpM5WK/I5KI3lF5R2dqhqi1fzJ52IZbKFHZZJIMU=; b=psPDb/fcDWXn6IzEYV/MgEugRCsrxQxC9iUM8mOApvPIU5Rh4qr5RckzOr+R/WQYwX 5uxbrFj7waF/wn/QhPCNEiWDTQGRfvnCkSQ8mi/ROb5lhYGYtDq4u6DugB34dQLc1Qbt MEPPUWs1MIVnkUqwTW5G+1tt/dOBLn3MIzAJA= 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=EPanpM5WK/I5KI3lF5R2dqhqi1fzJ52IZbKFHZZJIMU=; b=F2owjGK0zvVKufnAbFSq9tbBo6u+QVY4f5i9/OKffXz4znuI2dqV71+3XJVESsBVuN Fpq6wv04ZeMcJh9Fl3EQM4GtX2SPRIVS2F2PUOuKmwfZ9LAqn+mlp3PakJwafvi+jotn 8jCx1n3Ut53LWHBeKZbYnxp5WpNRXd/Q5Bm5CpEaw37mukI6dUWJAJN38hO/kCfkxbsC 2/g8OdSKn5PWdhg2LZ7BPYxrAnTFQcD+9BLZbNlhKJmUDOI7zNgNKg+ggUFVUlNERTf+ JJcwzqiLZd26vpubhr67qIWxM4dlqXuIS7xDqUhK3zBClm/IEY4+aiFLrJxrR5o54hjP x8oQ== X-Gm-Message-State: AOAM533QoyCbNeEWTfNsJgQt5+e+TNgiBWvdsOfcFkSGq9f4EzVhxEOB ge0NriaSfJh+uhJ4s9IdDhwERxW2 X-Google-Smtp-Source: ABdhPJw/Y3QxotmdUkeTaapAcaFpgfkr2ncjana0lasL6AJdN3lREVsqDEXsDVrXggGLj/nsqq6Lvw== X-Received: by 2002:a17:90a:f292:: with SMTP id fs18mr11025879pjb.188.1639563355415; Wed, 15 Dec 2021 02:15:55 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:1a8a:: with SMTP id ng10ls2499799pjb.1.canary-gmail; Wed, 15 Dec 2021 02:15:54 -0800 (PST) X-Received: by 2002:a17:90b:4c4c:: with SMTP id np12mr10909509pjb.68.1639563354723; Wed, 15 Dec 2021 02:15:54 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563354; cv=none; d=google.com; s=arc-20160816; b=rQkValf2kn7DHjiVOi3DFGNLZ/UjOki2TA5Ots8HABYgikca4blqaIG6cmj0mpDlqz 7qqq1h6byI4yLpFMsEq6dTRpDODWwL8OMRH7/fIWMi5rWcWv5dl57IGqDYenh3P82+aS r/K2mPrT/Ibvfv4OhJdhZ3kOms1IzaJ1t5T5aJQnYEO9eXpZIQ7dUlS0hZuHXasg/hDH CxbPNuajPvF7k5oJBccBnDejb24NNK61vl8z7KifMMO1j56RDF6NiCj1HFMt0g9keZMW A+9/1YJjgy6yro3/DatJA7pKoPyD7Q96DJXafuLB7v2l6nDOFoy99XStz2pYLqTNs4Iz CRmg== 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=vzWxnXfCEtfJtmf3hDGkV6u62l3KVpf2aBYAb8aByi8=; b=CpDICJ0b9g9hZWNi6yMWvOJki4EoRn2KfHm8sfbUIVrOxFCi2CrD608cciM0LmUUcG E7tL2GjF7FuY+wkbpdVEUWfuGbfxgoqa4EV3EWQXk2POU3TByNhPmgeBF9muUXsvfNmW UqoevXVPewNkbGQpnHw6/fEjmTZFQVZjgMxcxPfHVX7mY8tKm2znUtq4oGBxwp8bbUHY LKYLsA/7vnH/WY2PzGzYQSTliTgII6eMgr6f3Mnxgmmwi46hCDYmbjkQm+HJ/Pcl62gS YNF2EfUxqvHifYtanjLU0vw9bRxdlt744XJayjAQZFzaJK6Qdb80zYFjx5ZnfT5kmQfL EOyg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=FkFA+o0I; 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 o9sor739826pgv.52.2021.12.15.02.15.54 for (Google Transport Security); Wed, 15 Dec 2021 02:15:54 -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:8a4b:: with SMTP id y72mr7342101pgd.1.1639563354413; Wed, 15 Dec 2021 02:15:54 -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.51 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:15:54 -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 3/6] drm: exynos: dsi: Convert to bridge driver Date: Wed, 15 Dec 2021 15:45:31 +0530 Message-Id: <20211215101534.45003-4-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=FkFA+o0I; 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 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 | 85 +++++++++++++------------ 1 file changed, 44 insertions(+), 41 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 14e16f2d594b..29c68379e6be 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; @@ -287,9 +287,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 { @@ -880,9 +880,10 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) return 0; } -static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) +static void exynos_dsi_set_display_mode(struct drm_bridge *bridge) { - struct drm_display_mode *m = &dsi->encoder.crtc->state->adjusted_mode; + struct exynos_dsi *dsi = bridge_to_dsi(bridge); + struct drm_display_mode *m = &bridge->encoder->crtc->state->adjusted_mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; u32 reg; @@ -1374,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) @@ -1390,53 +1390,54 @@ 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_mode(bridge); 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 const struct drm_encoder_helper_funcs exynos_dsi_encoder_helper_funcs = { - .enable = exynos_dsi_enable, - .disable = exynos_dsi_disable, +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, + .attach = exynos_dsi_attach, }; MODULE_DEVICE_TABLE(of, exynos_dsi_of_match); @@ -1459,8 +1460,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. @@ -1499,13 +1501,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; } @@ -1591,8 +1594,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; @@ -1612,9 +1613,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); } @@ -1640,7 +1640,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; @@ -1708,6 +1707,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 Wed Dec 15 10:15:32 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1830 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 C24213F18E for ; Wed, 15 Dec 2021 11:16:01 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id lt10-20020a17090b354a00b001a649326aedsf16892739pjb.5 for ; Wed, 15 Dec 2021 02:16:01 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563359; cv=pass; d=google.com; s=arc-20160816; b=pkCS0ks+nCtK2tA4HXjMAgqLnPnfZGJJJW5VjNBdi2yvWuVf83nZTokWekcqPy7EFH fwfVNriveW3yt42UUcK1Bk4E94VXJq65GWIDXtw6MqsrZ04HGjPpbJ3k/HaPzCfciidl +G9jWCbABdplevdnGpeKk4mV4yOV1Rq8i9Cafe5zRKLq5nZQQ4UMGIQDqUBIO+qC238v RpZNw3zNxF7UssZMiaNDPqIQ0ldrTDJxEAAFKWuVj62oIKKsBWBjY+5wfs58oRKFX4Ig uiNnQ0i+lvV/oh+m+2yHbUPhHZ/dE0byQCkYgUupJqLBxp3QY43u9HK9hM1+0eNUAVSJ Iw1Q== 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=RmupOorVur8nb0PCFW2hO8t3ae0BK1YQGBFk/DZThec=; b=Hg5ztpxU4TEl6ZwCQ78APwhQAKYF41++p0d8GaNQs4Ymn7N3Pbqh5Cx7lpknUsrJk6 Ke5OrClx4w2P+YMV/F2PxfMOIuhyNJbFMGbDtqZ8abdGIQoZZGnyZUJ8mw8MrXCEosll 9/tniuObJhJyxl8GcoE19x1YMKAiCHMVS95el+wqyCP9oKfP9IfGgdv/ptg7cxR2T3F+ WMnaq2qSNKamTjAlhIEkjRn4m/yGYZc9iC/ibibcHV9mMeaPoAnM4FZnLTYB8ZXRWgdl V+QGJfrYjwI0HiBhzH4E4TG3qtkXYF4HYjmF1ubK+R4gyr4Z9MDaSJHlQSRs22MHuFNR kePQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HiXQKeyS; 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=RmupOorVur8nb0PCFW2hO8t3ae0BK1YQGBFk/DZThec=; b=ikIgkd6L3JT9dublNA/KMdwSNmwqnEjHDzKR5rDO7sMnY6BSeYEZYIRzLSptVZKjuT wiZkROLERiNrttkFOnmgFk45DHwg2UDuQBAj1/weJ9zYBy59ec7Su7MuJ1Lhme5F/h1p UOHXjS/TyJ8fEskpwnogp01LJUv1RyMTc+t7g= 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=RmupOorVur8nb0PCFW2hO8t3ae0BK1YQGBFk/DZThec=; b=0B41fdFS9/Td2DQzRkScK0a8qMdciMyppivcdi0pIa1zZ2G2jN8NMKXrO8jJQ2rh1X jvgB0TsfoMSQTpGQjAF5AGWLYBMlpzAKhlxDv3arGpgW0ZTDZtlKQAAf9GGxQNckmNOb AP8O1VKle3g55loxSmkQrtr95gMzcu+jEA0wvoo5+0X3+T3nwRlrFnsLvJRuqbwgP/30 wOWs1q1nG58j8o3f3dRfnFtQrNdvAWsVJ85V+PbAWpXhwBG4fRhOPnDdnfx5PbmfMgV4 NltMaHWJl7QYZjByhK6D6XptVcGmk2NQL+DPJ3+ZsudFljZf8U6dWriBB+u8wDmwuykC W/HQ== X-Gm-Message-State: AOAM531nK7sjIawG3jC/xk+O0fgmkE0iHlxesSVXO+O2LAhV0xosUXIN 2ahS+iu7aZyUuSXtO9hDEoXX1ZgG X-Google-Smtp-Source: ABdhPJycBoBKJbx2xEhphnfBFTJ21ydqISG/rDISCc61lZWfDOugOADnTfZSc/ASjBDRZvt5YudOZQ== X-Received: by 2002:a17:90b:3ec2:: with SMTP id rm2mr11180647pjb.1.1639563359179; Wed, 15 Dec 2021 02:15:59 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:7804:: with SMTP id t4ls696238pgc.3.gmail; Wed, 15 Dec 2021 02:15:58 -0800 (PST) X-Received: by 2002:a63:10a:: with SMTP id 10mr7417006pgb.172.1639563358461; Wed, 15 Dec 2021 02:15:58 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563358; cv=none; d=google.com; s=arc-20160816; b=bkHpINN+ckVxORdqeafyO2rIh/H2fKtb3GxlFC1F260PSpSEJ0rEzasYHUr6elx0mq fzo6jVDbpX4kGHjuWY14PiCXh4wJkg3CfoFOrJLCiChOG068jOWropUPMKQoOuaLe0fe 9GFwz8VF909+gak+tRZXZOvzP15KkcTyjvfV6tkuXcP2qh70poooQeefQ1UsaBf7axpA USXMjS32m7jQqBx+f6b6AA316JgiJfVnplkfFiWnoyWmh3VYPssP+T0dBU+/vwXw9PWN a1AIKmuKREpyfKFj1e0XHbp4UT1VL8pk23Rr5PYST4FGHReCB1U0exfhVWnvYcQAHJ3R tsNw== 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=+ZAOBOL9rgasMXWW86nZAQEbYkZElrISjQDknTY4WUs=; b=MbP+9ThLeTgmfDHo+7bbqTf0tlmy9gEiypIw5uoCKCPvZQUAFLmXoJXybJEWH1/xvP hMI/lgqcPvPQRtPYyXaDWY7W8U3AJIs8Fs35BzhPi2kPd0dBRzvXM4tEKNQtU4TCuB49 jKgR9cUgEXOmkr2LLQvOIdeAlziYVt0MA8ciQjuCLmIicQuJSxoFlhL6Lduyuy9TQ46F MDHVvujApYWYs3reo2PKcU2x/0TTfOiMueBieCe0SGvg9j+tn3TcCERAc+m14zUUXa3I GgPewxHCOIP3PS7CkgsMSKPdBFut7BMeyIa8p3UHy7BYarWHivSRM0TE/14ySO24UzbA +qLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HiXQKeyS; 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 v24sor755056pgl.65.2021.12.15.02.15.58 for (Google Transport Security); Wed, 15 Dec 2021 02:15:58 -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:2b88:: with SMTP id r130mr7480830pgr.80.1639563358174; Wed, 15 Dec 2021 02:15:58 -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.54 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:15:57 -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 4/6] drm: exynos: dsi: Switch to atomic funcs Date: Wed, 15 Dec 2021 15:45:32 +0530 Message-Id: <20211215101534.45003-5-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=HiXQKeyS; 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 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 29c68379e6be..983e7cb65e2a 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); @@ -1433,10 +1437,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, .attach = exynos_dsi_attach, }; @@ -1614,7 +1621,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 Wed Dec 15 10:15:33 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1831 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 3A82F3F18E for ; Wed, 15 Dec 2021 11:16:04 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id q2-20020a056a00084200b004a2582fcec1sf13339035pfk.15 for ; Wed, 15 Dec 2021 02:16:04 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563363; cv=pass; d=google.com; s=arc-20160816; b=e4sDxRbWD5UBG6SSFnS9sUG1eKD0bEnNXSCQ7e8TloAyXqb9LWLZIO7cSura5fqwq9 WvCeAG0Y/nS3k6sjATTmR7/XbddCNgpYskiMxInn/wVG0yv2jtiX38s8lA0XzZDgcSH3 +v5oZv+4Zx2P8J2Ieuf4jUVWhcLdvB6DR58k3zAh+pNCitA4aN/Xz1WNSeXUzY/ExqsV oHaeqtH7bl9tJc+zuk2115o2LFv2pMlwC9KHm+sMaEdvoWc7wPTsTI54hQaOpY5iq7zb FNBxYqZcN1LoB0D7W7FSRP91cTk6kAs63oNxsp0h5ndH5HZ/RObl3TckT+rj1iFKXrNc yj7w== 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=DXreobVupq51iXT4NV6fs8fsewfVquJRuxwtjjECoqE=; b=ou/XkGyRXi9ToJibs3bmvmOFp3hdKVKlh5hZj3/T6jOCzEfjwgAq3yj9fEmGqoULRb 8Br3mb2qvoZT/o7AkZrzqmcYATRPYFuhpz+/uPd94N3D+qG9af8jdYCPRfToS8UaNa12 ey9V3PgDxcOBXnuUsqk60ETREMjQLFSWoZ+7oYNKOo3TByzvtJxqw8kdCPPnD+p/rKj5 R0PlYibDTVuWVyYK4rpY0AkdYvNCckE2eVBlun1QO2mtRNRYk8vMIrAzlkXVBVODfnGO zaRVjoKb1++I/+HiAwoTq9+orBKOgvoYkJf4ZW6wNp3cuuNc0oahflbdoNuQZL4z0zZz /9/Q== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qOZAhpjK; 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=DXreobVupq51iXT4NV6fs8fsewfVquJRuxwtjjECoqE=; b=X7cR65b5U6w2zZE3myduxYbuuUdDqpk/dAR9AEPcWC+9JcO8Sgf1WxwgzA6/KuZ7j+ 9K5lbQ2be1UtCYxi2tuSdkELRNMaHMzcCfI41vylT99SeUdhfy1WwmtCliqwWU5EEooa 7UlZa4OUyKAngzbNKyug2ZVenWwKc1VKWi1KU= 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=DXreobVupq51iXT4NV6fs8fsewfVquJRuxwtjjECoqE=; b=CHlIShTNHeFXq8gjAfEul0bxf71zUdtvbwyM7oyoY4cIpIOotMwV/goMOhY0a3g4Oz +v8ZJZowq4q9mCX+4WJvi0j68N7abMOwFuTK/mXHI5BLAac482jb9HObNRaBC4gtbfRx Uz47Ye/7SSyB9Y/DsV0R9CrvDlWAFpOKuldvKuwbyfynAjJsW7e9hMCWhh/78lwtwRmq 6bzn4H2yKXVs3BuTSmwHTMceMOHChOipEfMt50EcNEuR13da5LDm1YNUL+Eq2eOrSH/x AIPV0ENdlzuR6cs5vPtibHpWDUyZxnAfhSu8PeStK0ObhR48MWGE2oCF4kT7fkKF8UEM qb7Q== X-Gm-Message-State: AOAM533Qqv6RdJUTnX/9sEeQOjkwGNUmC8+Sv9k83LxLfOTewQPnz1rA 13XDLnnPWLQ5yNvqOvAiGKiITh5F X-Google-Smtp-Source: ABdhPJzYbJlFDVT91gi/S2h+5Os0sjFDcBzpq9WiD1CSB5hOg3zYut6A6jewcj0hOTCL2rsU3IROdA== X-Received: by 2002:a17:902:d88b:b0:142:8acf:615b with SMTP id b11-20020a170902d88b00b001428acf615bmr10351103plz.62.1639563363031; Wed, 15 Dec 2021 02:16:03 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d4cc:: with SMTP id o12ls1194999plg.11.gmail; Wed, 15 Dec 2021 02:16:02 -0800 (PST) X-Received: by 2002:a17:902:b408:b0:148:aaf2:ea81 with SMTP id x8-20020a170902b40800b00148aaf2ea81mr1538131plr.123.1639563362294; Wed, 15 Dec 2021 02:16:02 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563362; cv=none; d=google.com; s=arc-20160816; b=WwXJAaEymhBRSLoHldjumzHTYtcnMm8J0npG72/+4rAnwtgBqv1xEEBhSawbDk73mt QkmNRL8VApbwD+giFEdJwj7rIgrSl663k4P54TLIAq0YKfM42ZoEwp5nLb4D4uflvC0F P59p/4or7pAKBV4n8oPr2rySkkfImSKbGC4APAohXFlid0hKhIdJKDX6TKXywDVStWeg z3DdJk+78b5ZRwRDhyuSpfhPbBSeK8QeBS1Y+GVsPx3OfdD2N1TvdadMclRvZVk0TCz/ 6660y5ml9hFTVZ+l4/a1cxvPMWCMEx/Zgo0AOiMVPJBdT7h8YgB1ZFfV+1SI+kpOpH+n /hcg== 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=aUe7iWsFUanDnWU/hqGWtr7c387T6EcARkQ4NxMuaBw=; b=l1g4uljnFhPy6fZHHb+Z2WPjiaLB//DRb64ynanfPFOmr4BvCxCLOL1LujQ9UV5/im A18T7jREyTkm1DoldCTk1m5Gl697QlIDflH3L+NxD75LhxYvVg4GwCMnhILpqdSkCmrx RDznJKjpyZFCyGSV4HKia9zNGZsKl8ZrWcw2JpiGWh2uDpTMbCHcFw4vTi/7cEjEJ1cs Y6NC3E/FA1mxF8goxKy9hHWcjCm68sWDOHJHj8g6G0O7v4t8/g+MYPtKK+0JfTiMHcv7 VaOypmAVed0MFez3HqNibpa3qDBDe2Zmy4ibUtg1xPiStgOlF72ZnT/8Hye1BxPTahpl 41FA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=qOZAhpjK; 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 t9sor750124pgp.31.2021.12.15.02.16.02 for (Google Transport Security); Wed, 15 Dec 2021 02:16:02 -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:a65:6a45:: with SMTP id o5mr7516185pgu.273.1639563362025; Wed, 15 Dec 2021 02:16:02 -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.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:16:01 -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 5/6] drm: exynos: dsi: Get the mode from bridge Date: Wed, 15 Dec 2021 15:45:33 +0530 Message-Id: <20211215101534.45003-6-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=qOZAhpjK; 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: , Now the exynos dsi driver is fully aware of bridge handling, so get the display mode from bridge, mode_set API instead of legacy encoder crtc. This makes bridge usage more efficient instead of relying on encoder stack. Add mode_set in drm_bridge_funcs. Signed-off-by: Jagan Teki --- Changes for v4, v3: - none drivers/gpu/drm/exynos/exynos_drm_dsi.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 983e7cb65e2a..774ca265ed3b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -276,6 +276,7 @@ struct exynos_dsi { u32 format; int state; + struct drm_display_mode mode; struct drm_property *brightness; struct completion completed; @@ -880,10 +881,9 @@ static int exynos_dsi_init_link(struct exynos_dsi *dsi) return 0; } -static void exynos_dsi_set_display_mode(struct drm_bridge *bridge) +static void exynos_dsi_set_display_mode(struct exynos_dsi *dsi) { - struct exynos_dsi *dsi = bridge_to_dsi(bridge); - struct drm_display_mode *m = &bridge->encoder->crtc->state->adjusted_mode; + struct drm_display_mode *m = &dsi->mode; unsigned int num_bits_resol = dsi->driver_data->num_bits_resol; u32 reg; @@ -1398,7 +1398,7 @@ static void exynos_dsi_atomic_enable(struct drm_bridge *bridge, { struct exynos_dsi *dsi = bridge_to_dsi(bridge); - exynos_dsi_set_display_mode(bridge); + exynos_dsi_set_display_mode(dsi); exynos_dsi_set_display_enable(dsi, true); dsi->state |= DSIM_STATE_VIDOUT_AVAILABLE; @@ -1428,6 +1428,15 @@ static void exynos_dsi_atomic_post_disable(struct drm_bridge *bridge, pm_runtime_put_sync(dsi->dev); } +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 = bridge_to_dsi(bridge); + + drm_mode_copy(&dsi->mode, adjusted_mode); +} + static int exynos_dsi_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { @@ -1444,6 +1453,7 @@ static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { .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, }; From patchwork Wed Dec 15 10:15:34 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1832 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 327E33F18E for ; Wed, 15 Dec 2021 11:16:08 +0100 (CET) Received: by mail-pj1-f69.google.com with SMTP id j16-20020a17090a841000b001b0e90738a8sf2568856pjn.7 for ; Wed, 15 Dec 2021 02:16:08 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639563367; cv=pass; d=google.com; s=arc-20160816; b=MuVzlRBRELhBkon9VUD+S55cl5c+bB22JJeDZvK0BvqPvqCqQBpV3vJ4vU3SI2KXXo /zEOv8oF38jOm/TRu+mRWDGlDJoVWV3iHCctEPYgv5KeiOMryCvA32fQeg2YApy1XE5h hyi2c1OCcwZozOiIr7/hHKijse5iIfIZlWv1+lqgumRKkeO3UL9RneM0CFu3rUjNzLtc fdWIiyh4cV5w4fW5fGBz9tZpyBL9ztdL0GQi5GllFiXs9k3PdQVYdHtm4bqQ5Evg0R8G /DtLy9isyNQxBOM+X7XP1UdhIUW7eVHRL+GtEBshMpCo6vkHkXvuhVMiStKlPwEooWtp RZKQ== 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=4v2j1vbWKSV/PnV2ZLw00D72it4PDU4qTWU2pDvgar8=; b=Q/S1YpeAakWwfftJXI+Wov8AHg023C3i0o4098Gc8L9QAGultHmmhhrcdnrdXWtqx7 GEE3k8lr0hFpakKSQJqAhAvVnkvaz48nmIq4gJzS90NNlEVDrZw0Q9qOh4E98C6ptKMc kenbzV+t16jbFXNhzAOFRv8sA6OJacJpfEGUYmqZynzX89w1p7+OAogWKRHkz08M6mLD Gh6OcL6qOhT9YvhGRSWXDkJ4atMGiSkM4DXCDttKFaadZFX0DUc4odqV4o5qi/zb76Xc Itru3DPBCngH1/auFn3eDphdRysC0yi2/F7lsOOpWn4Z5H2hJB1mdN4JBNv/I+DqCLV4 5s6w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BIUrIsUX; 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=4v2j1vbWKSV/PnV2ZLw00D72it4PDU4qTWU2pDvgar8=; b=AbpzNu0TgkOr77ZGGNSL8kel17dcgBgiVM3NRIvosqIU39AC9VrJ41lYoB0AjAG9zo au4lYDMxiiJhgCIVSibQALmrAgWRlWdY84KZqU7YJk+fRZoeuZrtVVT+qsSMr3H7+B+j rMTuW1PeTw1QHvmrDkLSLFzj1UPXOpViOddW8= 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=4v2j1vbWKSV/PnV2ZLw00D72it4PDU4qTWU2pDvgar8=; b=LqDTm1QJTTmVtsCui+WwqxiE69SFAaxGyFjaP8UEqUvA7W3y+5vVSxuooeoMafWtsY YiMW/tPriMdje8kZZSCxbw/nwQXzHXeFT7hL+TVz6xWmB1Q8GtU5pzZM7jcRDMnOKoBm MPh6OrftBDlWR/Hw1oMR9nS5vJY/+X2oS6H5Bg2DDf0XEbXX09fIk5+nNNyk+0ZQxuRi heEZZK0Qtk4mybWvL0rlVxVRYysywmcmcAuzTtZVocjR0M7yUfm/1XGOfOX8kVi0L//Y /XsWn72bmzt8ypAj6cQp9IxFFI9s3f0IkT2ixXvg4rLFKitLEfuSFoTYQoQRrOk1Y6ir 6GaQ== X-Gm-Message-State: AOAM530fjZSHWMtLJLylaHD1SabFh94XODOKPFQ8EwYaY2Jn8yxOs9hi Drf9fOp1J0ngJD6wM5o1sHrtjZes X-Google-Smtp-Source: ABdhPJxewh3F0GFag6TyPHW9v25d3VxOT4ewQF1ML7sm2ewTinILSUkQ8mDN3TzSXCkaAnoOiII/2A== X-Received: by 2002:a17:90b:1b07:: with SMTP id nu7mr11013660pjb.140.1639563367062; Wed, 15 Dec 2021 02:16:07 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e5d0:: with SMTP id u16ls1213580plf.0.gmail; Wed, 15 Dec 2021 02:16:06 -0800 (PST) X-Received: by 2002:a17:90b:1c81:: with SMTP id oo1mr11136598pjb.137.1639563366312; Wed, 15 Dec 2021 02:16:06 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639563366; cv=none; d=google.com; s=arc-20160816; b=PwelsatTbBwxy+3yUDozkk4SFh50G/jGaZCFsbYE8WUCCBRElbtj0e3+WcsdHxV75j XrN588oqm/lRif4iO/G2fYRFM/0TEdvqAlStdkMjZaNQnlj79jm5RSInJaQgb8fJUyw4 Wp1XYmaaPbKljZiycYXbRHki3IXh/Ut56law/6qnUZnCTNL3H3DIAzK6Rk47VdbaSEYD KtKXdlyygagLVkhXpKg8lgovl5d+VVrASc6INNyPDfFb2IGXmFCMAtv5Ub3aW9pWaDyD RXhzOWijYdBHcahwMroFnk4ytBdXGApmozdwB6uEE3eDJ42KH6GMfqV6veH+QCIqxSs7 nneQ== 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=7mwCQQOx25soOzwU54V6juPjb/T8Ui/I/Y0mS6KWFZw=; b=lilF1gtBLQmzyL9n3WhCH0kRFKLw1AqPuzn4ok4t/40fFG7YhASvxV2q9vM+OCcZkc AB9tEBhynG5m9AAici2O/5Bj+v550CN+kcNGyGlHFHPoDR1qqMNhd9xZWP18bI0TK9xr +tivgTj16XDwAqTJTsRQ86RN9rKVU+o4pquDPSBHL2YOB5ler4MYHSZEKThR8EjK1Puu BcDc8M0XSm/1A2j4O6//j3BXOxhqnW4WSnotVMBElgIdXTBcLB2o0woUUnr01uWDH+tv VbEZM7onyZvSbrZtXWFkIBv+XNqO/+FBGzVFhIW2GNRINBt4KNFzCVMNn8/oGL3AOgva LdoQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=BIUrIsUX; 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 s4sor1792976plq.38.2021.12.15.02.16.06 for (Google Transport Security); Wed, 15 Dec 2021 02:16:06 -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:b210:b0:143:789a:7418 with SMTP id t16-20020a170902b21000b00143789a7418mr10193966plr.38.1639563366055; Wed, 15 Dec 2021 02:16:06 -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.16.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Dec 2021 02:16:05 -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 6/6] drm: exynos: dsi: Move DSI init in bridge enable Date: Wed, 15 Dec 2021 15:45:34 +0530 Message-Id: <20211215101534.45003-7-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=BIUrIsUX; 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 enable as the bridge enable API as it is common across all classes of DSI device drivers. Signed-off-by: Jagan Teki --- Changes for v4: - none Changes for v3: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 774ca265ed3b..d853dd8d1271 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1397,6 +1397,14 @@ 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); + int ret; + + if (!(dsi->state & DSIM_STATE_INITIALIZED)) { + ret = exynos_dsi_init(dsi); + if (ret) + return; + dsi->state |= DSIM_STATE_INITIALIZED; + } exynos_dsi_set_display_mode(dsi); exynos_dsi_set_display_enable(dsi, true); @@ -1539,13 +1547,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;