Message ID | 20230807061115.3244501-1-victor.liu@nxp.com |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:c44e:0:b0:3f2:4152:657d with SMTP id w14csp1267620vqr; Sun, 6 Aug 2023 23:57:07 -0700 (PDT) X-Google-Smtp-Source: AGHT+IGL/Zjf7m7yI63rwmr9Vw6iFR5xiUYmkEj72mFmOSQ1NQ8CLYBevfLUy1L2t2gZyF5Ti9LC X-Received: by 2002:a17:902:f551:b0:1bb:c7bc:ceb8 with SMTP id h17-20020a170902f55100b001bbc7bcceb8mr7669522plf.22.1691391426711; Sun, 06 Aug 2023 23:57:06 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1691391426; cv=pass; d=google.com; s=arc-20160816; b=tdnSxfuf4CU07hR6tcB4GMbvZxuk5igoa0Q+gMSB6x/37hmDm+CW9cH/uwUt5qd9cD bQsfUweOdo516JT4Y7n55FQEGkkz6vJpvmKykicPyUusn3Y8R6SU5uJWgi7yP98WLh0/ gQhqAfY8aiY6omoJsLbZSopOuJs6hj5g/Loy/dsKQFit5QIxFFnf+m7i5W8kRpPryOFL CkYX0kkcZR8b2Yj0WAqkF60R6/RzzsPT8y3TbkIBPi+xtWhVOPxEb/qGgLHCj6lvzwMl 3Zj/lhj0+3jDkxFX/k+df9kmf9soqRBBmPIEsitJIpB2gxQQ3dRiWyJ8EdU69Q15RDzk aayQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:mime-version:content-transfer-encoding :message-id:date:subject:cc:to:from:dkim-signature; bh=zZmDnc1a1KpVpPMuG03e10+QC3pZKZZgk8/B2IspMYQ=; fh=yGpp1vdOy2FRqEDDcnWVccPS+V9lhRf4aJX7+R5qvUc=; b=IBePMsLXm5xMCK74JkE9y18NM7OOyNbwKPIqepk6YW6whs5FNFDrKhmedabqGaejas 98sHMH8L77C7ykgr+iZZIwt/EjqH7QLSNo3WUHbx8GRTaJWvXunXO649thaytzfez+jX v5vSxR4A73LiPoDv3HqUPmCPxjmixN4MeSv9Sjw8Q4nD01oAbKPecXTSKUJyA33mah6p ntBKuWs0wIMFZpIjwlOikWoFzSrC0SgAcNpC3b8A1LyMoNnKJo/GCiyBRMw8Thh8urkb E4/XWsTzIwsbxcvPGaS51/q0BBAYKeG7LmxUynXQFRdtppjUMDeFUy7bleef2JRABcJy Mhtg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jDu+iAoX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id w1-20020a631601000000b005579e1fc429si5141907pgl.669.2023.08.06.23.56.53; Sun, 06 Aug 2023 23:57:06 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@nxp.com header.s=selector2 header.b=jDu+iAoX; arc=pass (i=1 spf=pass spfdomain=nxp.com dkim=pass dkdomain=nxp.com dmarc=pass fromdomain=nxp.com); spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=nxp.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230517AbjHGGGw (ORCPT <rfc822;aaronkmseo@gmail.com> + 99 others); Mon, 7 Aug 2023 02:06:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59390 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230513AbjHGGGt (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Mon, 7 Aug 2023 02:06:49 -0400 Received: from EUR03-AM7-obe.outbound.protection.outlook.com (mail-am7eur03on2042.outbound.protection.outlook.com [40.107.105.42]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 57D1B10F6 for <linux-kernel@vger.kernel.org>; Sun, 6 Aug 2023 23:06:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=Q/hu2s5c37kf9g97lQeixyRVvJ1gOf+dYRbsD5zTRAEhDiJWdtIe6VkeYmG9gg2+tY3vsrOUbr3iWTZW5/RszyIVu4ID1DkllPfXQvrEKz3XJ0d91MZTNaS6D2Tm2YQA0kOEX4okm/G8lvHwg8haPjzzWy4jlXsHkicGlyJ5uwuxuqOx87a5M/JulfLcK3AEXKcyovWtz2Q7R0QHfJ+SxTEpelZ9VchJnDgNjay5SB0N8QNwkLy63Z7Tdrw4joHR7a8iu8Mom645XX0tiCrI9pPqUH8Uk3p+6TJXV0+lUbFiiaUF+IV8g/1zAVKZaKscdrM/bMjMdgBlyXnL6/Ld2Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=zZmDnc1a1KpVpPMuG03e10+QC3pZKZZgk8/B2IspMYQ=; b=AWL/WoVbzDw004UFDOO4AOe82ptDgi42ZF/IadWzVAFnnkvXWTzqlFOT8D1/Kzc4Xw+s7pzbWKKqLdZ1wAYxaNqC6/d9qkAf1WXMLNGEdwjX2tjNtpQZEYkqeExHHdKVR9G09gwz7EE2SCbxlkNy/l+MM8BbAMHUUam/CF+hsNel7PS9Gq5gX/8unsfD9ST4O0RHa8GCJRvml5liP2MIo10iIaZ0QdK0mEiRaPfdd9iLo3ZA+nYmYexKL0wtIVSoE6ntW+FpNhDVhBy+dIVQAwYd60xzqSHlndXagTeWt2g3jVUAbTy/bZl7jBdLS2rvG8SQrd3rt76/dmdw0kv6iQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=nxp.com; dmarc=pass action=none header.from=nxp.com; dkim=pass header.d=nxp.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=nxp.com; s=selector2; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=zZmDnc1a1KpVpPMuG03e10+QC3pZKZZgk8/B2IspMYQ=; b=jDu+iAoX1HFWuM366HOB2Ry0z9+v+U0dggmrscO7huvATM1QSMias8/xWK72K7x1Gfs2762QBb5MsSoZMxX5/VoJxFv1GOWCQ4dlfPICcdhELZgKSfQrFM57jc7jHggWDnlztgGa5qnHWw02BJjZTUBxfiO/7lzJAbhDOz0waD8= Authentication-Results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=nxp.com; Received: from AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) by AS8PR04MB9125.eurprd04.prod.outlook.com (2603:10a6:20b:448::7) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6652.26; Mon, 7 Aug 2023 06:06:45 +0000 Received: from AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b]) by AM7PR04MB7046.eurprd04.prod.outlook.com ([fe80::9018:e395:332c:e24b%4]) with mapi id 15.20.6652.026; Mon, 7 Aug 2023 06:06:44 +0000 From: Liu Ying <victor.liu@nxp.com> To: dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Cc: andrzej.hajda@intel.com, neil.armstrong@linaro.org, rfoss@kernel.org, Laurent.pinchart@ideasonboard.com, jonas@kwiboo.se, jernej.skrabec@gmail.com, airlied@gmail.com, daniel@ffwll.ch, Ulf Hansson <ulf.hansson@linaro.org> Subject: [PATCH v3] drm/bridge: panel: Add a device link between drm device and panel device Date: Mon, 7 Aug 2023 14:11:15 +0800 Message-Id: <20230807061115.3244501-1-victor.liu@nxp.com> X-Mailer: git-send-email 2.37.1 Content-Transfer-Encoding: 8bit Content-Type: text/plain X-ClientProxiedBy: SG2PR06CA0186.apcprd06.prod.outlook.com (2603:1096:4:1::18) To AM7PR04MB7046.eurprd04.prod.outlook.com (2603:10a6:20b:113::22) MIME-Version: 1.0 X-MS-PublicTrafficType: Email X-MS-TrafficTypeDiagnostic: AM7PR04MB7046:EE_|AS8PR04MB9125:EE_ X-MS-Office365-Filtering-Correlation-Id: 899eb515-7fdd-474f-776a-08db970c7a0e X-MS-Exchange-SenderADCheck: 1 X-MS-Exchange-AntiSpam-Relay: 0 X-Microsoft-Antispam: BCL:0; X-Microsoft-Antispam-Message-Info: wVH3qdRDA2eicp7gRru10Nw/lFwG5ZRw9LlTPH93nzVdpv7gdIZBIm8SlTs+gHs42FyeXPusykCmctB4bVzfh7G8O7bZlylPC8kJ9sgXeQqCGVu4jdLN6MEDrIffgi6Gr7eg0cEDLqiEt1bDF+GVThH3aZTz8SBqcLueu6M+6RY2PpXZcOSPHgjOw/cUbl+R07BCdsBKw7tc2BmCBfMA/eeuWQXYYbBBhyok1aGBKWD1gYoFnaki7w4/3k6Pkph8ft+Egtp4VKRMS6kpI/AGjjsWu9LQ0AiN4rDb2u65QLk50tsKZYtHCfBB4vD6Yozvqx1i+3czjJcHl8bAYNSIxnoQe64/q8rRAWAJIC8Swzwt5NoNj0GaP/syQxzvbIH5tfcl28koFSDy5CWdwqo5mCpMmyCptQp2DlzJZnFLX7NAyEYyByyF5pY/vGTcWUC3MHeRXoAlKd9qsg8TE01TsE711nW41LGxe+0reai5W0AHALRTku+cO9cGt5ZSqf2gNAzD+T8EYl9VY9S3PwGP/atoU8gNJ2UOThRmhH95ceu/dzN/aVFqIhtKWE9WitizryqkpJoSwX+MVVqpN9ITZKQXbrRrb19OKD6gDyS44gE= X-Forefront-Antispam-Report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:AM7PR04MB7046.eurprd04.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230028)(4636009)(376002)(346002)(366004)(396003)(136003)(39860400002)(1800799003)(186006)(451199021)(1076003)(41300700001)(26005)(2906002)(5660300002)(83380400001)(7416002)(8936002)(8676002)(2616005)(478600001)(86362001)(316002)(6506007)(38350700002)(38100700002)(6486002)(66476007)(66556008)(52116002)(66946007)(6666004)(6512007)(966005)(4326008)(36756003);DIR:OUT;SFP:1101; X-MS-Exchange-AntiSpam-MessageData-ChunkCount: 1 X-MS-Exchange-AntiSpam-MessageData-0: G4N9rUBw4gI5xvx6rVg/4uHOjocxIBaGv+jC2UlnX/iKFXRst/RVaCswUSJHqAiRRR9/K7uB0ZVKak2ibXQsOddGabtA/lySC6/EN2BSpz5eI+YxsBl0GYVnheYS4Qiqj3Q8gx3V2Dv9iV26VJ7MCJUZGgxCxmKTFSpW22TLUSNEBFURSQMdAWA/vDTiOmYY1mP1sfloGpg5AxYfzrW2BDV7ZgSTfR4PybBgO68Y95W9sz+BVPe1wU7ObxDlzN741uxOZ2YOKLGK6ClPRZ1Q55HIKRkECOPewpfmSQQfYktkAWzFsXZShX7zHPmg9RKSMnOBvpY5W2rrY8hw9PSBy7HdduFKBburOSWXTVht0StyCrr4YL6Z66iRuQ6zysf5A/keuRfPvYnH1LMrUrW38zgVM37kQr7NffBdKbheqkNqJ8HZX6/AXRgnAvwJc/au/IodtRjo42TsU7Z//Nn8qhPshOD9j2lAjwk36/9tcwW9vv2JNttl4x8+DEcPvex2++t+bzw7jLvxSUR1KeDMNixJF9cx0Cu3+WynvETX2guvQG2/XkL+L5wOExzKMJdo60uQDslb+dqo26qtEhB5v7IhBLshFcIg49gV/XmAdvMyX6S653YxwyIeEvfw4EpcsQtxZhZGQNeda4VaB+sNyWyDXSRndm9C/PzekiQKhA9VRDxr67sl1ZWQ29Wma8tS8vqEM3Vn52I1sCkZQblJR6lUcVsPxprVk/vn0PuzG07+upO3y/DF1xlMrL/9GJMQnaHt3kJpdjLj7Ov70dLjKjy2mNe8OOpqSjdrKjd1yTJlo9fP/DxE+iGvaRwh7mWkkifYazYv/kQnJTcMpYy4zqK6nubRyKgS6V1ex+B+NuiLgk4gg5CwaOWdCtoE5mg8/sO+m0ezti513sV54HVzIxwGHPrLPZI+54kzObvz19fAK0d2mAk35c11pE1KXUqjedtEVMEDskfZkGlIuXPvH6KafOhVsQd6TGOUGhacHT17tO6qDitTANfiSrO03E+gdz2MuEZuRL/JNZW/yZZdUAJhXkShBqY01NgpZVzcnSTMYM2Auhs/mPCQv/GEi4m+EdtoKqhL8FvW7HGcrid8VXy/34zM6tIMlNiZfA/k5cRwxfe6CRila7zTyQ0tug6azZlfGz+G0Tp2O/OBhgWSH1U/EKoZmF8Hce2gopgaWeMOyzqzdWui9Sxpbxlfg1ZCbpArqvHbITiz4g3UH3cYrciSz0ZTHnC6+UBFMv4busogXPVexw71dcGfUg7PakNPOLo1a/WNf/e8cceayj2YpTtsNVwfDsv9/nTwK3x6CJzL0rPnlLOeC2UTCvszbqdNpLTQYU2lwagqyEjuf8yXs28mayO8B+j9zwSDpvYxr/WIjGyA2Gs6QJ4eL+cZ8aIc1DJPFjVHwXQKGqnwuX16pdVJaoY9fXKmtfwAvcbodKN2SNKm2BbTlAJR9PgjveHKMRGDdo5Rcvd6xlLEcW7Mz5GMQ+y7Y0Z7nudsOA+6kPBZqGWFoE49e+KhGF1u/VR/L1Ga/cislz7XGAO6jZF9u3HWjE7G8/LoamnlQz59VJJ4qFcauTywBhrMWoQ5MXN6 X-OriginatorOrg: nxp.com X-MS-Exchange-CrossTenant-Network-Message-Id: 899eb515-7fdd-474f-776a-08db970c7a0e X-MS-Exchange-CrossTenant-AuthSource: AM7PR04MB7046.eurprd04.prod.outlook.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-OriginalArrivalTime: 07 Aug 2023 06:06:44.8104 (UTC) X-MS-Exchange-CrossTenant-FromEntityHeader: Hosted X-MS-Exchange-CrossTenant-Id: 686ea1d3-bc2b-4c6f-a92c-d99c5c301635 X-MS-Exchange-CrossTenant-MailboxType: HOSTED X-MS-Exchange-CrossTenant-UserPrincipalName: fxiLoS88ERSs4Xov1EAqWb3YoU6v+bWG4fCkD6DoFyR42CA6UiyJRxubYAtGmWCPcjXdvLWiHFjIj7GyKeKqBg== X-MS-Exchange-Transport-CrossTenantHeadersStamped: AS8PR04MB9125 X-Spam-Status: No, score=-2.1 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_BLOCKED, RCVD_IN_MSPIKE_H2,SPF_HELO_PASS,SPF_PASS autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1773552456931710582 X-GMAIL-MSGID: 1773552456931710582 |
Series |
[v3] drm/bridge: panel: Add a device link between drm device and panel device
|
|
Commit Message
Liu Ying
Aug. 7, 2023, 6:11 a.m. UTC
Add the device link when panel bridge is attached and delete the link
when panel bridge is detached. The drm device is the consumer while
the panel device is the supplier. This makes sure that the drm device
suspends eariler and resumes later than the panel device, hence resolves
problems where the order is reversed, like the problematic case mentioned
in the below link.
Link: https://lore.kernel.org/lkml/CAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL+8fV-7s1CTMqi7u3-Rg@mail.gmail.com/T/
Suggested-by: Ulf Hansson <ulf.hansson@linaro.org>
Signed-off-by: Liu Ying <victor.liu@nxp.com>
---
v2->v3:
* Improve commit message s/swapped/reversed/.
v1->v2:
* Fix bailout for panel_bridge_attach() in case device_link_add() fails.
drivers/gpu/drm/bridge/panel.c | 16 ++++++++++++++++
1 file changed, 16 insertions(+)
Comments
On Mon, 7 Aug 2023 at 08:06, Liu Ying <victor.liu@nxp.com> wrote: > > Add the device link when panel bridge is attached and delete the link > when panel bridge is detached. The drm device is the consumer while > the panel device is the supplier. This makes sure that the drm device > suspends eariler and resumes later than the panel device, hence resolves > problems where the order is reversed, like the problematic case mentioned > in the below link. > > Link: https://lore.kernel.org/lkml/CAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL+8fV-7s1CTMqi7u3-Rg@mail.gmail.com/T/ > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> > Signed-off-by: Liu Ying <victor.liu@nxp.com> Looks good to me! Just a minor question though, don't we need to manage runtime PM too - or this is solely for system wide suspend/resume? Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Kind regards Uffe > --- > v2->v3: > * Improve commit message s/swapped/reversed/. > > v1->v2: > * Fix bailout for panel_bridge_attach() in case device_link_add() fails. > > drivers/gpu/drm/bridge/panel.c | 16 ++++++++++++++++ > 1 file changed, 16 insertions(+) > > diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c > index 9316384b4474..a6587d233505 100644 > --- a/drivers/gpu/drm/bridge/panel.c > +++ b/drivers/gpu/drm/bridge/panel.c > @@ -4,6 +4,8 @@ > * Copyright (C) 2017 Broadcom > */ > > +#include <linux/device.h> > + > #include <drm/drm_atomic_helper.h> > #include <drm/drm_bridge.h> > #include <drm/drm_connector.h> > @@ -19,6 +21,7 @@ struct panel_bridge { > struct drm_bridge bridge; > struct drm_connector connector; > struct drm_panel *panel; > + struct device_link *link; > u32 connector_type; > }; > > @@ -60,6 +63,8 @@ static int panel_bridge_attach(struct drm_bridge *bridge, > { > struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); > struct drm_connector *connector = &panel_bridge->connector; > + struct drm_panel *panel = panel_bridge->panel; > + struct drm_device *drm_dev = bridge->dev; > int ret; > > if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) > @@ -70,6 +75,14 @@ static int panel_bridge_attach(struct drm_bridge *bridge, > return -ENODEV; > } > > + panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, > + DL_FLAG_STATELESS); > + if (!panel_bridge->link) { > + DRM_ERROR("Failed to add device link between %s and %s\n", > + dev_name(drm_dev->dev), dev_name(panel->dev)); > + return -EINVAL; > + } > + > drm_connector_helper_add(connector, > &panel_bridge_connector_helper_funcs); > > @@ -78,6 +91,7 @@ static int panel_bridge_attach(struct drm_bridge *bridge, > panel_bridge->connector_type); > if (ret) { > DRM_ERROR("Failed to initialize connector\n"); > + device_link_del(panel_bridge->link); > return ret; > } > > @@ -100,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge) > struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); > struct drm_connector *connector = &panel_bridge->connector; > > + device_link_del(panel_bridge->link); > + > /* > * Cleanup the connector if we know it was initialized. > * > -- > 2.37.1 >
On Wednesday, August 9, 2023 9:54 PM Ulf Hansson <ulf.hansson@linaro.org> wrote: > > On Mon, 7 Aug 2023 at 08:06, Liu Ying <victor.liu@nxp.com> wrote: > > > > Add the device link when panel bridge is attached and delete the link > > when panel bridge is detached. The drm device is the consumer while > > the panel device is the supplier. This makes sure that the drm device > > suspends eariler and resumes later than the panel device, hence resolves > > problems where the order is reversed, like the problematic case mentioned > > in the below link. > > > > Link: > https://lore.k/ > ernel.org%2Flkml%2FCAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL%2B8fV- > 7s1CTMqi7u3- > Rg%40mail.gmail.com%2FT%2F&data=05%7C01%7Cvictor.liu%40nxp.com%7 > Cb498937c20c94ab9148908db98e02662%7C686ea1d3bc2b4c6fa92cd99c5c30 > 1635%7C0%7C0%7C638271860697989733%7CUnknown%7CTWFpbGZsb3d8e > yJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D > %7C3000%7C%7C%7C&sdata=iGMdYWbOeyVxzy9T9THCNh%2Ff%2BbKFLP0tI > m%2BowL7h5Og%3D&reserved=0 > > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> > > Signed-off-by: Liu Ying <victor.liu@nxp.com> > > Looks good to me! Just a minor question though, don't we need to > manage runtime PM too - or this is solely for system wide > suspend/resume? I think this is solely for system wide suspend/resume. AFAICS, there is no any particular need to manage runtime PM. > > Reviewed-by: Ulf Hansson <ulf.hansson@linaro.org> Thank you for your review. Regards, Liu Ying > > Kind regards > Uffe > > > --- > > v2->v3: > > * Improve commit message s/swapped/reversed/. > > > > v1->v2: > > * Fix bailout for panel_bridge_attach() in case device_link_add() fails. > > > > drivers/gpu/drm/bridge/panel.c | 16 ++++++++++++++++ > > 1 file changed, 16 insertions(+) > > > > diff --git a/drivers/gpu/drm/bridge/panel.c > b/drivers/gpu/drm/bridge/panel.c > > index 9316384b4474..a6587d233505 100644 > > --- a/drivers/gpu/drm/bridge/panel.c > > +++ b/drivers/gpu/drm/bridge/panel.c > > @@ -4,6 +4,8 @@ > > * Copyright (C) 2017 Broadcom > > */ > > > > +#include <linux/device.h> > > + > > #include <drm/drm_atomic_helper.h> > > #include <drm/drm_bridge.h> > > #include <drm/drm_connector.h> > > @@ -19,6 +21,7 @@ struct panel_bridge { > > struct drm_bridge bridge; > > struct drm_connector connector; > > struct drm_panel *panel; > > + struct device_link *link; > > u32 connector_type; > > }; > > > > @@ -60,6 +63,8 @@ static int panel_bridge_attach(struct drm_bridge > *bridge, > > { > > struct panel_bridge *panel_bridge = > drm_bridge_to_panel_bridge(bridge); > > struct drm_connector *connector = &panel_bridge->connector; > > + struct drm_panel *panel = panel_bridge->panel; > > + struct drm_device *drm_dev = bridge->dev; > > int ret; > > > > if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) > > @@ -70,6 +75,14 @@ static int panel_bridge_attach(struct drm_bridge > *bridge, > > return -ENODEV; > > } > > > > + panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, > > + DL_FLAG_STATELESS); > > + if (!panel_bridge->link) { > > + DRM_ERROR("Failed to add device link between %s and %s\n", > > + dev_name(drm_dev->dev), dev_name(panel->dev)); > > + return -EINVAL; > > + } > > + > > drm_connector_helper_add(connector, > > &panel_bridge_connector_helper_funcs); > > > > @@ -78,6 +91,7 @@ static int panel_bridge_attach(struct drm_bridge > *bridge, > > panel_bridge->connector_type); > > if (ret) { > > DRM_ERROR("Failed to initialize connector\n"); > > + device_link_del(panel_bridge->link); > > return ret; > > } > > > > @@ -100,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge > *bridge) > > struct panel_bridge *panel_bridge = > drm_bridge_to_panel_bridge(bridge); > > struct drm_connector *connector = &panel_bridge->connector; > > > > + device_link_del(panel_bridge->link); > > + > > /* > > * Cleanup the connector if we know it was initialized. > > * > > -- > > 2.37.1 > >
Hi, On Mon, 07 Aug 2023 14:11:15 +0800, Liu Ying wrote: > Add the device link when panel bridge is attached and delete the link > when panel bridge is detached. The drm device is the consumer while > the panel device is the supplier. This makes sure that the drm device > suspends eariler and resumes later than the panel device, hence resolves > problems where the order is reversed, like the problematic case mentioned > in the below link. > > [...] Thanks, Applied to https://anongit.freedesktop.org/git/drm/drm-misc.git (drm-misc-next) [1/1] drm/bridge: panel: Add a device link between drm device and panel device https://cgit.freedesktop.org/drm/drm-misc/commit/?id=199cf07ebd2b0d41185ac79b895547d45610b681
On Mon, Aug 7, 2023 at 8:06 AM Liu Ying <victor.liu@nxp.com> wrote: > Add the device link when panel bridge is attached and delete the link > when panel bridge is detached. The drm device is the consumer while > the panel device is the supplier. This makes sure that the drm device > suspends eariler and resumes later than the panel device, hence resolves > problems where the order is reversed, like the problematic case mentioned > in the below link. > > Link: https://lore.kernel.org/lkml/CAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL+8fV-7s1CTMqi7u3-Rg@mail.gmail.com/T/ > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> > Signed-off-by: Liu Ying <victor.liu@nxp.com> > --- > v2->v3: > * Improve commit message s/swapped/reversed/. This patch causes a regression in the Ux500 MCDE drivers/gpu/drm/mcde/* driver with the nt35510 panel drivers/gpu/drm/panel/panel-novatek-nt35510.c my dmesg looks like this: [ 1.678680] mcde a0350000.mcde: MCDE clk rate 199680000 Hz [ 1.684448] mcde a0350000.mcde: found MCDE HW revision 3.0 (dev 8, metal fix 0) [ 1.692840] mcde-dsi a0351000.dsi: HW revision 0x02327457 [ 1.699310] mcde-dsi a0351000.dsi: attached DSI device with 2 lanes [ 1.705627] mcde-dsi a0351000.dsi: format 00000000, 24bpp [ 1.711059] mcde-dsi a0351000.dsi: mode flags: 00000400 [ 1.716400] mcde-dsi a0351000.dsi: registered DSI host [ 1.722473] mcde-dsi a0352000.dsi: HW revision 0x02327457 [ 1.727874] mcde-dsi a0352000.dsi: registered DSI host [ 1.733734] mcde-dsi a0353000.dsi: HW revision 0x02327457 [ 1.739135] mcde-dsi a0353000.dsi: registered DSI host [ 1.814971] mcde-dsi a0351000.dsi: connected to panel [ 1.820037] mcde-dsi a0351000.dsi: initialized MCDE DSI bridge [ 1.825958] mcde a0350000.mcde: bound a0351000.dsi (ops mcde_dsi_component_ops) [ 1.833312] mcde-dsi a0352000.dsi: unused DSI interface [ 1.838531] mcde a0350000.mcde: bound a0352000.dsi (ops mcde_dsi_component_ops) [ 1.845886] mcde-dsi a0353000.dsi: unused DSI interface [ 1.851135] mcde a0350000.mcde: bound a0353000.dsi (ops mcde_dsi_component_ops) [ 1.858917] [drm:panel_bridge_attach] *ERROR* Failed to add device link between a0350000.mcde and a0351000.dsi.0 [ 1.869171] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc/mcde@a0350000/dsi@a0351000/panel to encoder None-34: -22 [ 1.880920] [drm:drm_bridge_attach] *ERROR* failed to attach bridge /soc/mcde@a0350000/dsi@a0351000 to encoder None-34: -22 [ 1.892120] mcde a0350000.mcde: failed to attach display output bridge [ 1.898773] mcde a0350000.mcde: adev bind failed: -22 [ 1.903991] mcde a0350000.mcde: failed to add component master [ 1.909912] mcde: probe of a0350000.mcde failed with error -22 [ 1.916656] ------------[ cut here ]------------ [ 1.921295] WARNING: CPU: 1 PID: 1 at drivers/regulator/core.c:2996 _regulator_disable+0x130/0x190 [ 1.930297] unbalanced disables for AUX6 [ 1.934265] Modules linked in: [ 1.937347] CPU: 1 PID: 1 Comm: swapper/0 Not tainted 6.6.0-08649-g7d461b291e65 #3 [ 1.944915] Hardware name: ST-Ericsson Ux5x0 platform (Device Tree Support) [ 1.951873] unwind_backtrace from show_stack+0x10/0x14 [ 1.957122] show_stack from dump_stack_lvl+0x40/0x4c [ 1.962188] dump_stack_lvl from __warn+0x84/0xc8 [ 1.966918] __warn from warn_slowpath_fmt+0x124/0x190 [ 1.972076] warn_slowpath_fmt from _regulator_disable+0x130/0x190 [ 1.978271] _regulator_disable from regulator_bulk_disable+0x5c/0x100 [ 1.984802] regulator_bulk_disable from nt35510_remove+0x1c/0x58 [ 1.990905] nt35510_remove from mipi_dsi_drv_remove+0x18/0x20 [ 1.996765] mipi_dsi_drv_remove from device_release_driver_internal+0x184/0x1f8 [ 2.004180] device_release_driver_internal from bus_remove_device+0xc0/0xe4 [ 2.011230] bus_remove_device from device_del+0x14c/0x464 [ 2.016723] device_del from device_unregister+0xc/0x20 [ 2.021972] device_unregister from mipi_dsi_remove_device_fn+0x34/0x3c [ 2.028594] mipi_dsi_remove_device_fn from device_for_each_child+0x64/0xa4 [ 2.035583] device_for_each_child from mipi_dsi_host_unregister+0x24/0x50 [ 2.042480] mipi_dsi_host_unregister from platform_remove+0x20/0x5c [ 2.048858] platform_remove from device_release_driver_internal+0x184/0x1f8 [ 2.055908] device_release_driver_internal from bus_remove_device+0xc0/0xe4 [ 2.062957] bus_remove_device from device_del+0x14c/0x464 [ 2.068450] device_del from platform_device_del.part.0+0x10/0x74 [ 2.074554] platform_device_del.part.0 from platform_device_unregister+0x18/0x24 [ 2.082061] platform_device_unregister from of_platform_device_destroy+0x9c/0xac [ 2.089569] of_platform_device_destroy from device_for_each_child_reverse+0x78/0xbc [ 2.097320] device_for_each_child_reverse from devm_of_platform_populate_release+0x34/0x48 [ 2.105682] devm_of_platform_populate_release from devres_release_all+0x94/0xf8 [ 2.113098] devres_release_all from device_unbind_cleanup+0xc/0x60 [ 2.119384] device_unbind_cleanup from really_probe+0x1a0/0x2d8 [ 2.125396] really_probe from __driver_probe_device+0x84/0xd4 [ 2.131225] __driver_probe_device from driver_probe_device+0x30/0x104 [ 2.137756] driver_probe_device from __driver_attach+0x90/0x178 [ 2.143768] __driver_attach from bus_for_each_dev+0x7c/0xcc [ 2.149444] bus_for_each_dev from bus_add_driver+0xcc/0x1cc [ 2.155120] bus_add_driver from driver_register+0x7c/0x114 [ 2.160705] driver_register from do_one_initcall+0x5c/0x190 [ 2.166381] do_one_initcall from kernel_init_freeable+0x1f8/0x250 [ 2.172576] kernel_init_freeable from kernel_init+0x18/0x12c [ 2.178344] kernel_init from ret_from_fork+0x14/0x28 [ 2.183410] Exception stack(0xf08c5fb0 to 0xf08c5ff8) [ 2.188446] 5fa0: 00000000 00000000 00000000 00000000 [ 2.196624] 5fc0: 00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000 [ 2.204803] 5fe0: 00000000 00000000 00000000 00000000 00000013 00000000 [ 2.211486] ---[ end trace 0000000000000000 ]--- [ 2.216125] Failed to disable vddi: -EIO [ 2.220062] panel-novatek-nt35510 a0351000.dsi.0: Failed to power off Reverting the patch solves the problem. See device tree at e.g.: arch/arm/boot/dts/st/ste-ux500-samsung-skomer.dts The usual problems with patches like this is that our DSI panel is attached in the DT without any graph: mcde@a0350000 { status = "okay"; pinctrl-names = "default"; pinctrl-0 = <&dsi_default_mode>; dsi@a0351000 { panel { /* NT35510-based Hydis HVA40WV1 */ compatible = "hydis,hva40wv1", "novatek,nt35510"; reg = <0>; /* v_lcd_3v0 2.3-4.8V */ vdd-supply = <&ab8500_ldo_aux4_reg>; /* v_lcd_1v8 1.65-3.3V */ vddi-supply = <&ab8500_ldo_aux6_reg>; /* GPIO 139 */ reset-gpios = <&gpio4 11 GPIO_ACTIVE_LOW>; pinctrl-names = "default"; pinctrl-0 = <&display_default_mode>; backlight = <&ktd253>; }; }; }; The DSI bridge is inside the display controller (MCDE) and the panel is right inside the DSI bridge. Suggestions welcome, I'm clueless why this happens. Yours, Linus Walleij
Hi Linus, On Wednesday, November 15, 2023 6:00 AM, Linus Walleij <linus.walleij@linaro.org> wrote: > On Mon, Aug 7, 2023 at 8:06 AM Liu Ying <victor.liu@nxp.com> wrote: > > > Add the device link when panel bridge is attached and delete the link > > when panel bridge is detached. The drm device is the consumer while > > the panel device is the supplier. This makes sure that the drm device > > suspends eariler and resumes later than the panel device, hence resolves > > problems where the order is reversed, like the problematic case mentioned > > in the below link. > > > > Link: > https://lore.k/ > ernel.org%2Flkml%2FCAPDyKFr0XjrU_udKoUKQ_q8RWaUkyqL%2B8fV- > 7s1CTMqi7u3- > Rg%40mail.gmail.com%2FT%2F&data=05%7C01%7Cvictor.liu%40nxp.com%7 > Cd007e6260de84d50c92b08dbe55d10e5%7C686ea1d3bc2b4c6fa92cd99c5c3 > 01635%7C0%7C0%7C638355960110773397%7CUnknown%7CTWFpbGZsb3d8 > eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3 > D%7C3000%7C%7C%7C&sdata=eXtezc2MPeFy1uo09iqHlYJq3iA6S%2BfxSre5y > s7xrhc%3D&reserved=0 > > Suggested-by: Ulf Hansson <ulf.hansson@linaro.org> > > Signed-off-by: Liu Ying <victor.liu@nxp.com> > > --- > > v2->v3: > > * Improve commit message s/swapped/reversed/. > > This patch causes a regression in the Ux500 MCDE > drivers/gpu/drm/mcde/* driver with the nt35510 panel > drivers/gpu/drm/panel/panel-novatek-nt35510.c > my dmesg looks like this: > > [ 1.678680] mcde a0350000.mcde: MCDE clk rate 199680000 Hz > [ 1.684448] mcde a0350000.mcde: found MCDE HW revision 3.0 (dev 8, > metal fix 0) > [ 1.692840] mcde-dsi a0351000.dsi: HW revision 0x02327457 > [ 1.699310] mcde-dsi a0351000.dsi: attached DSI device with 2 lanes > [ 1.705627] mcde-dsi a0351000.dsi: format 00000000, 24bpp > [ 1.711059] mcde-dsi a0351000.dsi: mode flags: 00000400 > [ 1.716400] mcde-dsi a0351000.dsi: registered DSI host > [ 1.722473] mcde-dsi a0352000.dsi: HW revision 0x02327457 > [ 1.727874] mcde-dsi a0352000.dsi: registered DSI host > [ 1.733734] mcde-dsi a0353000.dsi: HW revision 0x02327457 > [ 1.739135] mcde-dsi a0353000.dsi: registered DSI host > [ 1.814971] mcde-dsi a0351000.dsi: connected to panel > [ 1.820037] mcde-dsi a0351000.dsi: initialized MCDE DSI bridge > [ 1.825958] mcde a0350000.mcde: bound a0351000.dsi (ops > mcde_dsi_component_ops) > [ 1.833312] mcde-dsi a0352000.dsi: unused DSI interface > [ 1.838531] mcde a0350000.mcde: bound a0352000.dsi (ops > mcde_dsi_component_ops) > [ 1.845886] mcde-dsi a0353000.dsi: unused DSI interface > [ 1.851135] mcde a0350000.mcde: bound a0353000.dsi (ops > mcde_dsi_component_ops) > [ 1.858917] [drm:panel_bridge_attach] *ERROR* Failed to add device > link between a0350000.mcde and a0351000.dsi.0 Sorry for the breakage and a bit late response(I'm a bit busy with internal things). I think device_link_add() fails because a0351000.dsi.0 already depends on a0350000.mcde. Can you confirm that device_link_add() returns NULL right after it calls device_is_dependent()? Does this patch fix the issue? --------------------------------------8<--------------------------------------------------- diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index e48823a4f1ed..d44de301a312 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -23,6 +23,7 @@ struct panel_bridge { struct drm_panel *panel; struct device_link *link; u32 connector_type; + bool is_independent; }; static inline struct panel_bridge * @@ -67,12 +68,17 @@ static int panel_bridge_attach(struct drm_bridge *bridge, struct drm_device *drm_dev = bridge->dev; int ret; - panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, - DL_FLAG_STATELESS); - if (!panel_bridge->link) { - DRM_ERROR("Failed to add device link between %s and %s\n", - dev_name(drm_dev->dev), dev_name(panel->dev)); - return -EINVAL; + panel_bridge->is_independent = !device_is_dependent(drm_dev->dev, + panel->dev); + + if (panel_bridge->is_independent) { + panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, + DL_FLAG_STATELESS); + if (!panel_bridge->link) { + DRM_ERROR("Failed to add device link between %s and %s\n", + dev_name(drm_dev->dev), dev_name(panel->dev)); + return -EINVAL; + } } if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) @@ -92,7 +98,8 @@ static int panel_bridge_attach(struct drm_bridge *bridge, panel_bridge->connector_type); if (ret) { DRM_ERROR("Failed to initialize connector\n"); - device_link_del(panel_bridge->link); + if (panel_bridge->is_independent) + device_link_del(panel_bridge->link); return ret; } @@ -115,7 +122,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge) struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); struct drm_connector *connector = &panel_bridge->connector; - device_link_del(panel_bridge->link); + if (panel_bridge->is_independent) + device_link_del(panel_bridge->link); /* * Cleanup the connector if we know it was initialized. --------------------------------------8<--------------------------------------------------- > [ 1.869171] [drm:drm_bridge_attach] *ERROR* failed to attach bridge > /soc/mcde@a0350000/dsi@a0351000/panel to encoder None-34: -22 > [ 1.880920] [drm:drm_bridge_attach] *ERROR* failed to attach bridge > /soc/mcde@a0350000/dsi@a0351000 to encoder None-34: -22 > [ 1.892120] mcde a0350000.mcde: failed to attach display output bridge > [ 1.898773] mcde a0350000.mcde: adev bind failed: -22 > [ 1.903991] mcde a0350000.mcde: failed to add component master > [ 1.909912] mcde: probe of a0350000.mcde failed with error -22 > [ 1.916656] ------------[ cut here ]------------ > [ 1.921295] WARNING: CPU: 1 PID: 1 at drivers/regulator/core.c:2996 > _regulator_disable+0x130/0x190 > [ 1.930297] unbalanced disables for AUX6 > [ 1.934265] Modules linked in: > [ 1.937347] CPU: 1 PID: 1 Comm: swapper/0 Not tainted > 6.6.0-08649-g7d461b291e65 #3 > [ 1.944915] Hardware name: ST-Ericsson Ux5x0 platform (Device Tree > Support) > [ 1.951873] unwind_backtrace from show_stack+0x10/0x14 > [ 1.957122] show_stack from dump_stack_lvl+0x40/0x4c > [ 1.962188] dump_stack_lvl from __warn+0x84/0xc8 > [ 1.966918] __warn from warn_slowpath_fmt+0x124/0x190 > [ 1.972076] warn_slowpath_fmt from _regulator_disable+0x130/0x190 > [ 1.978271] _regulator_disable from regulator_bulk_disable+0x5c/0x100 > [ 1.984802] regulator_bulk_disable from nt35510_remove+0x1c/0x58 > [ 1.990905] nt35510_remove from mipi_dsi_drv_remove+0x18/0x20 > [ 1.996765] mipi_dsi_drv_remove from > device_release_driver_internal+0x184/0x1f8 > [ 2.004180] device_release_driver_internal from > bus_remove_device+0xc0/0xe4 > [ 2.011230] bus_remove_device from device_del+0x14c/0x464 > [ 2.016723] device_del from device_unregister+0xc/0x20 > [ 2.021972] device_unregister from mipi_dsi_remove_device_fn+0x34/0x3c > [ 2.028594] mipi_dsi_remove_device_fn from > device_for_each_child+0x64/0xa4 > [ 2.035583] device_for_each_child from > mipi_dsi_host_unregister+0x24/0x50 > [ 2.042480] mipi_dsi_host_unregister from platform_remove+0x20/0x5c > [ 2.048858] platform_remove from > device_release_driver_internal+0x184/0x1f8 > [ 2.055908] device_release_driver_internal from > bus_remove_device+0xc0/0xe4 > [ 2.062957] bus_remove_device from device_del+0x14c/0x464 > [ 2.068450] device_del from platform_device_del.part.0+0x10/0x74 > [ 2.074554] platform_device_del.part.0 from > platform_device_unregister+0x18/0x24 > [ 2.082061] platform_device_unregister from > of_platform_device_destroy+0x9c/0xac > [ 2.089569] of_platform_device_destroy from > device_for_each_child_reverse+0x78/0xbc > [ 2.097320] device_for_each_child_reverse from > devm_of_platform_populate_release+0x34/0x48 > [ 2.105682] devm_of_platform_populate_release from > devres_release_all+0x94/0xf8 > [ 2.113098] devres_release_all from device_unbind_cleanup+0xc/0x60 > [ 2.119384] device_unbind_cleanup from really_probe+0x1a0/0x2d8 > [ 2.125396] really_probe from __driver_probe_device+0x84/0xd4 > [ 2.131225] __driver_probe_device from driver_probe_device+0x30/0x104 > [ 2.137756] driver_probe_device from __driver_attach+0x90/0x178 > [ 2.143768] __driver_attach from bus_for_each_dev+0x7c/0xcc > [ 2.149444] bus_for_each_dev from bus_add_driver+0xcc/0x1cc > [ 2.155120] bus_add_driver from driver_register+0x7c/0x114 > [ 2.160705] driver_register from do_one_initcall+0x5c/0x190 > [ 2.166381] do_one_initcall from kernel_init_freeable+0x1f8/0x250 > [ 2.172576] kernel_init_freeable from kernel_init+0x18/0x12c > [ 2.178344] kernel_init from ret_from_fork+0x14/0x28 > [ 2.183410] Exception stack(0xf08c5fb0 to 0xf08c5ff8) > [ 2.188446] 5fa0: 00000000 > 00000000 00000000 00000000 > [ 2.196624] 5fc0: 00000000 00000000 00000000 00000000 00000000 > 00000000 00000000 00000000 > [ 2.204803] 5fe0: 00000000 00000000 00000000 00000000 00000013 > 00000000 > [ 2.211486] ---[ end trace 0000000000000000 ]--- > [ 2.216125] Failed to disable vddi: -EIO > [ 2.220062] panel-novatek-nt35510 a0351000.dsi.0: Failed to power off > > Reverting the patch solves the problem. > > See device tree at e.g.: > arch/arm/boot/dts/st/ste-ux500-samsung-skomer.dts > > The usual problems with patches like this is that our DSI panel > is attached in the DT without any graph: > > mcde@a0350000 { > status = "okay"; > pinctrl-names = "default"; > pinctrl-0 = <&dsi_default_mode>; > > dsi@a0351000 { > panel { > /* NT35510-based Hydis HVA40WV1 */ > compatible = "hydis,hva40wv1", > "novatek,nt35510"; > reg = <0>; > /* v_lcd_3v0 2.3-4.8V */ > vdd-supply = <&ab8500_ldo_aux4_reg>; > /* v_lcd_1v8 1.65-3.3V */ > vddi-supply = <&ab8500_ldo_aux6_reg>; > /* GPIO 139 */ > reset-gpios = <&gpio4 11 > GPIO_ACTIVE_LOW>; > pinctrl-names = "default"; > pinctrl-0 = <&display_default_mode>; > backlight = <&ktd253>; > }; > }; > }; > > The DSI bridge is inside the display controller (MCDE) and the panel is > right inside the DSI bridge. This indicates that the panel device already depends on the mcde device. Regards, Liu Ying > > Suggestions welcome, I'm clueless why this happens. > > Yours, > Linus Walleij
Hi Ying, On Mon, Nov 20, 2023 at 11:08 AM Ying Liu <victor.liu@nxp.com> wrote: [Me] > > > v2->v3: > > > * Improve commit message s/swapped/reversed/. > > > > This patch causes a regression in the Ux500 MCDE > > drivers/gpu/drm/mcde/* driver with the nt35510 panel > > drivers/gpu/drm/panel/panel-novatek-nt35510.c > > my dmesg looks like this: (...) > Sorry for the breakage and a bit late response(I'm a bit busy with internal > things). > > I think device_link_add() fails because a0351000.dsi.0 already depends > on a0350000.mcde. Can you confirm that device_link_add() returns NULL > right after it calls device_is_dependent()? > > Does this patch fix the issue? Yep it works! You missed one device_link_del() instance on the errorpath. Tested-by: Linus Walleij <linus.walleij@linaro.org> Can you send it as a proper patch? Yours, Linus Walleij
On Wednesday, November 22, 2023 9:59 PM, Linus Walleij <linus.walleij@linaro.org> wrote: > Hi Ying, Hi Linus, > > On Mon, Nov 20, 2023 at 11:08 AM Ying Liu <victor.liu@nxp.com> wrote: > > [Me] > > > > v2->v3: > > > > * Improve commit message s/swapped/reversed/. > > > > > > This patch causes a regression in the Ux500 MCDE > > > drivers/gpu/drm/mcde/* driver with the nt35510 panel > > > drivers/gpu/drm/panel/panel-novatek-nt35510.c > > > my dmesg looks like this: > (...) > > Sorry for the breakage and a bit late response(I'm a bit busy with internal > > things). > > > > I think device_link_add() fails because a0351000.dsi.0 already depends > > on a0350000.mcde. Can you confirm that device_link_add() returns NULL > > right after it calls device_is_dependent()? > > > > Does this patch fix the issue? > > Yep it works! > > You missed one device_link_del() instance on the errorpath. Will add it. > > Tested-by: Linus Walleij <linus.walleij@linaro.org> Thanks for the test. > > Can you send it as a proper patch? Will do. Regards, Liu Ying
diff --git a/drivers/gpu/drm/bridge/panel.c b/drivers/gpu/drm/bridge/panel.c index 9316384b4474..a6587d233505 100644 --- a/drivers/gpu/drm/bridge/panel.c +++ b/drivers/gpu/drm/bridge/panel.c @@ -4,6 +4,8 @@ * Copyright (C) 2017 Broadcom */ +#include <linux/device.h> + #include <drm/drm_atomic_helper.h> #include <drm/drm_bridge.h> #include <drm/drm_connector.h> @@ -19,6 +21,7 @@ struct panel_bridge { struct drm_bridge bridge; struct drm_connector connector; struct drm_panel *panel; + struct device_link *link; u32 connector_type; }; @@ -60,6 +63,8 @@ static int panel_bridge_attach(struct drm_bridge *bridge, { struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); struct drm_connector *connector = &panel_bridge->connector; + struct drm_panel *panel = panel_bridge->panel; + struct drm_device *drm_dev = bridge->dev; int ret; if (flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR) @@ -70,6 +75,14 @@ static int panel_bridge_attach(struct drm_bridge *bridge, return -ENODEV; } + panel_bridge->link = device_link_add(drm_dev->dev, panel->dev, + DL_FLAG_STATELESS); + if (!panel_bridge->link) { + DRM_ERROR("Failed to add device link between %s and %s\n", + dev_name(drm_dev->dev), dev_name(panel->dev)); + return -EINVAL; + } + drm_connector_helper_add(connector, &panel_bridge_connector_helper_funcs); @@ -78,6 +91,7 @@ static int panel_bridge_attach(struct drm_bridge *bridge, panel_bridge->connector_type); if (ret) { DRM_ERROR("Failed to initialize connector\n"); + device_link_del(panel_bridge->link); return ret; } @@ -100,6 +114,8 @@ static void panel_bridge_detach(struct drm_bridge *bridge) struct panel_bridge *panel_bridge = drm_bridge_to_panel_bridge(bridge); struct drm_connector *connector = &panel_bridge->connector; + device_link_del(panel_bridge->link); + /* * Cleanup the connector if we know it was initialized. *