Received: by 2002:a05:6a11:4021:0:0:0:0 with SMTP id ky33csp11763pxb; Mon, 13 Sep 2021 11:35:43 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwR0v8Ug9Nm3ZdujZEEfbprkt9eb5pb3P4Bfue/cUIZLnCEnAlGh+fvOloUfhtRQgDQt51D X-Received: by 2002:a6b:cd83:: with SMTP id d125mr9661687iog.126.1631558143562; Mon, 13 Sep 2021 11:35:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1631558143; cv=none; d=google.com; s=arc-20160816; b=gZNGiU+qWQzOLmE/VDnX3a5wAoGPyh3P5tLB/B0TbCTc+FtVKKQH3MIds2Kc9C2S1M wWupEUDC5I40z+xBJnzR3piiGbjrwhRekxGDxPIlpTqAWB+3PTfzTIsc8663Q5KwBVmh B/OOlSFiit92qLSug4rVF7MOf0+qdpnP+ftO4yRnqbF8Sqrf/+7+XTIaR97EZ4dx/nd3 T5N3x+DF+xembJFbjkPxLhLMlxHoVdkT1kbg0aBFk8T3eZ3NbabPusOqdNMZb4B+OIFR jXE9ItLkBWYmJqj6MZqpE8+GYLIH5ybTp1DNl4NmBHJ/BGoZylGLptnfu0nhHoaffNKN 3HfA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=wwDbi/F1yzMdGSzPisZP/TR90sy0EJXO0nvDjAz0B6Y=; b=C3jCmrqwqfzYoLmgzA2lGyrFzcZcEsZoFTLWCaeU2osHGTChTw6hwaTvPOO4+G2cZv K0j+5SrZhovvMwGzJAjShdjskVFjERhggxdYHAFPVQxijB8tcyLcgQk84A/z315g0iZ9 ggV7IwhpZZr28NX9d1IIv9BnKiazpGXrP99OHMi47A5fvHZaJPnUP4HZMZUrc5yk9I2/ EcXwRgLfR8Hv33dRDPnDchOxX8wZKByEqU3a9dZIYhxDup0WHmODAFviG9uVrqwOFHOS L/k2jEpKcf3Jz1qXuN4IKcGmMSQH833K5brrWYpjDL+w404t/sCgTkcCITvt0nyUKavm rrgA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g54zQBkc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id b184si7771145jab.61.2021.09.13.11.35.29; Mon, 13 Sep 2021 11:35:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=g54zQBkc; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234945AbhIMMwi (ORCPT + 99 others); Mon, 13 Sep 2021 08:52:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51920 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235840AbhIMMwh (ORCPT ); Mon, 13 Sep 2021 08:52:37 -0400 Received: from mail-wr1-x434.google.com (mail-wr1-x434.google.com [IPv6:2a00:1450:4864:20::434]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0CF52C061574 for ; Mon, 13 Sep 2021 05:51:21 -0700 (PDT) Received: by mail-wr1-x434.google.com with SMTP id x6so14494365wrv.13 for ; Mon, 13 Sep 2021 05:51:20 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=wwDbi/F1yzMdGSzPisZP/TR90sy0EJXO0nvDjAz0B6Y=; b=g54zQBkc0ygeJjGKY66WSYgOIek2MabARkvMCD1ydHRDdOGI/mNWhtuw+gDwTIko3u cpwhkBQVQTdXSbP7AbFq5czpikXB753YMjlYptR3gO1OBxWUCCP7YmJhDFVDYMEl6q4n Fb1ympWZ/lpRtSW3VeLnQanKpUmB+bWAo3kBrUbA9qkLo4Uv9+cBFemBYpBpqK1trrC1 oq/U6gTRy08r9KpatwSWdunihSZ4AjjLfG6qDIp8NZxFiYDET/Mt0vw4d3r/Jm+A44zT s1Hd5JH4Bx2peeDA6Par1SxtEyx85JkR9mmtoofiAXWxPMir6cdYHsudVZ9Bf42RgAO+ AXGw== 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:mime-version :content-transfer-encoding; bh=wwDbi/F1yzMdGSzPisZP/TR90sy0EJXO0nvDjAz0B6Y=; b=KnfykfTmBPlVlAe9C1NaqNsw6CTouc36A54UpehTdUWZhAE4sutEOX/WAGZ6zjwKFz HrEcv2+j5a5VjJVRGtP99JkHStfJKzmg62USgvrf1Lui6j28DcJxhVU/KMLFdvTyUYl0 XxQYBa6c0xym+sT9OWTysyjJ9JDn6rLRyxT6+RuHm+Do7IJ3i0vf7IvMemrxU/e7RF6F 1VAV1wrLawRAXYvLQn/PkLMe84Uk47Yxe2qyhQ30TX5BcAC47UrgguPIQlj+sF/A/57a TM3iXXpl0incts18iWEYXD5DGD5u0+WnaQBKZX8I0XYb9npmPFLYUH0AK1fBH+DYKH3R adBQ== X-Gm-Message-State: AOAM533uGzJn1e4srJRsXfnqN+pTyyXQEPdsaa0oAjHxtYGQF1PMPb7z pUCI3W0Bf0K3iRPHlxiDtHBhQ4JKecbe X-Received: by 2002:a5d:6b07:: with SMTP id v7mr8901817wrw.250.1631537479663; Mon, 13 Sep 2021 05:51:19 -0700 (PDT) Received: from alex-ThinkPad-E480.. ([2a02:810b:f40:4200:cd7c:5225:d3bf:f045]) by smtp.googlemail.com with ESMTPSA id x21sm7145287wmc.14.2021.09.13.05.51.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 13 Sep 2021 05:51:19 -0700 (PDT) From: Alex Bee To: Sandy Huang , =?UTF-8?q?Heiko=20St=C3=BCbner?= , Andy Yan Cc: David Airlie , Daniel Vetter , dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-rockchip@lists.infradead.org, linux-kernel@vger.kernel.org, Alex Bee Subject: [PATCH] drm/rockchip: add DRM_BRIDGE_ATTACH_NO_CONNECTOR flag to drm_bridge_attach Date: Mon, 13 Sep 2021 14:51:08 +0200 Message-Id: <20210913125108.195704-1-knaerzche@gmail.com> X-Mailer: git-send-email 2.30.2 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Commit a25b988ff83f ("drm/bridge: Extend bridge API to disable connector creation") added DRM_BRIDGE_ATTACH_NO_CONNECTOR bridge flag and all bridges handle this flag in some way since then. Newly added bridge drivers must no longer contain the connector creation and will fail probing if this flag isn't set. In order to be able to connect to those newly added bridges as well, make use of drm_bridge_connector API and have the connector initialized by the display controller. Signed-off-by: Alex Bee --- drivers/gpu/drm/rockchip/rockchip_lvds.c | 29 ++++++++++++++++-------- drivers/gpu/drm/rockchip/rockchip_rgb.c | 26 ++++++++++++++++++++- 2 files changed, 45 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/rockchip/rockchip_lvds.c b/drivers/gpu/drm/rockchip/rockchip_lvds.c index 551653940e39..e3953c72fbdb 100644 --- a/drivers/gpu/drm/rockchip/rockchip_lvds.c +++ b/drivers/gpu/drm/rockchip/rockchip_lvds.c @@ -19,6 +19,7 @@ #include #include +#include #include #include #include @@ -612,9 +613,9 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, } drm_encoder_helper_add(encoder, lvds->soc_data->helper_funcs); + connector = &lvds->connector; if (lvds->panel) { - connector = &lvds->connector; connector->dpms = DRM_MODE_DPMS_OFF; ret = drm_connector_init(drm_dev, connector, &rockchip_lvds_connector_funcs, @@ -627,17 +628,27 @@ static int rockchip_lvds_bind(struct device *dev, struct device *master, drm_connector_helper_add(connector, &rockchip_lvds_connector_helper_funcs); - - ret = drm_connector_attach_encoder(connector, encoder); - if (ret < 0) { - DRM_DEV_ERROR(drm_dev->dev, - "failed to attach encoder: %d\n", ret); - goto err_free_connector; - } } else { - ret = drm_bridge_attach(encoder, lvds->bridge, NULL, 0); + ret = drm_bridge_attach(encoder, lvds->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) goto err_free_encoder; + + connector = drm_bridge_connector_init(lvds->drm_dev, encoder); + if (IS_ERR(connector)) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to initialize bridge connector: %pe\n", + connector); + ret = PTR_ERR(connector); + goto err_free_encoder; + } + } + + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to attach encoder: %d\n", ret); + goto err_free_connector; } pm_runtime_enable(dev); diff --git a/drivers/gpu/drm/rockchip/rockchip_rgb.c b/drivers/gpu/drm/rockchip/rockchip_rgb.c index d691d9bef8e7..09be9678f2bd 100644 --- a/drivers/gpu/drm/rockchip/rockchip_rgb.c +++ b/drivers/gpu/drm/rockchip/rockchip_rgb.c @@ -10,6 +10,7 @@ #include #include +#include #include #include #include @@ -27,6 +28,7 @@ struct rockchip_rgb { struct drm_device *drm_dev; struct drm_bridge *bridge; struct drm_encoder encoder; + struct drm_connector connector; int output_mode; }; @@ -80,6 +82,7 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, int ret = 0, child_count = 0; struct drm_panel *panel; struct drm_bridge *bridge; + struct drm_connector *connector; rgb = devm_kzalloc(dev, sizeof(*rgb), GFP_KERNEL); if (!rgb) @@ -142,12 +145,32 @@ struct rockchip_rgb *rockchip_rgb_init(struct device *dev, rgb->bridge = bridge; - ret = drm_bridge_attach(encoder, rgb->bridge, NULL, 0); + ret = drm_bridge_attach(encoder, rgb->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) goto err_free_encoder; + connector = &rgb->connector; + connector = drm_bridge_connector_init(rgb->drm_dev, encoder); + if (IS_ERR(connector)) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to initialize bridge connector: %pe\n", + connector); + ret = PTR_ERR(connector); + goto err_free_encoder; + } + + ret = drm_connector_attach_encoder(connector, encoder); + if (ret < 0) { + DRM_DEV_ERROR(drm_dev->dev, + "failed to attach encoder: %d\n", ret); + goto err_free_connector; + } + return rgb; +err_free_connector: + drm_connector_cleanup(connector); err_free_encoder: drm_encoder_cleanup(encoder); return ERR_PTR(ret); @@ -157,6 +180,7 @@ EXPORT_SYMBOL_GPL(rockchip_rgb_init); void rockchip_rgb_fini(struct rockchip_rgb *rgb) { drm_panel_bridge_remove(rgb->bridge); + drm_connector_cleanup(&rgb->connector); drm_encoder_cleanup(&rgb->encoder); } EXPORT_SYMBOL_GPL(rockchip_rgb_fini); base-commit: 6880fa6c56601bb8ed59df6c30fd390cc5f6dd8f -- 2.30.2