From patchwork Mon Feb 19 10:09:13 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Faiz Abbas X-Patchwork-Id: 202992 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:693c:2685:b0:108:e6aa:91d0 with SMTP id mn5csp1187480dyc; Mon, 19 Feb 2024 02:10:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCUgasNYnCro6f4qlj2ccZ1x6DB3D1cV0jmZv4XNHiAbP0EdLy0Cs2Zxb4CSiLR9UKMooVRUnBhP2h71wdlDZUwVJhajcg== X-Google-Smtp-Source: AGHT+IG6vGSv+QVJuXQziJxsXq8GltjdUxkNekUSG29vWFPGzznWHp+JZLyMotWGmlW1RfRTkV4A X-Received: by 2002:aa7:c6cd:0:b0:564:4f6d:ddc1 with SMTP id b13-20020aa7c6cd000000b005644f6dddc1mr2491649eds.31.1708337411114; Mon, 19 Feb 2024 02:10:11 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708337411; cv=pass; d=google.com; s=arc-20160816; b=GxJavez2tjCYY0+zywjVhPCL5VRNhtW8pl9IaC/cuTmPpfBkUjSCS2jouJODHEs18O tWYkWrK9uC+HXwfthIbdPexOv6SN+2vdffbkkLTGrmUgKMG+052EX256LQ1jREUyrK9t RzL39yYHOpNw60XmfONaqTKIWvpaB7b+NU2gQ5Grg1yAiyuNv7x4cYELdkmT1qkxNMS3 cqpHLHRbP7zyhqlL5DM7/uA1z7t2LjAFqEfu4CyhYjrtKnafI+1aPtIp6IAkJZO049iw W5boIy2e8T2j47HfXZjZ0OfQAHTBRb0DTIAn12vhaopS4lqNMOxXeJ8e51cE8uHWolqD Rgpg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from; bh=3eWnF3JcGAL/pKzap5x4dMQgMWG9TLjG5KWcRDRSd30=; fh=dx8DbI9TeNJJkSzHj/c+TozYIktuxUzSK1EQ7Thrsz8=; b=hhVsL8HDdlPK8zUtMwYA9lzz1iq8y7M59rBdU2N5ZLiL6ehKwHi/KRA8qF8qHC1N/I 4EoMcKs3j6ymG/Gc03O75WWuLdUCX4F67tewJPbDxn+YhNvOsH1zngbJ5oYfI2yMd+Nk ZB2mAVL0Pf2PzZKIgkwbWeBV4X+rU/IJs2RU88srPRYFRsWLOlIyVL7kUHGqKr2ryph1 pV/s15+i6njpt7NqUw/ZmhkVqO08eXeNhRxzPejrLxuKY1dPYgHiMMyhhfRDnXXtFlqX Mgdka5NM1t8NIgclyU0tJFSfbkUKDCcPSEoqWrd2oWJAI8l6lSzV4tl0yLgiNLg+5oRE V+AQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-71096-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71096-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [147.75.80.249]) by mx.google.com with ESMTPS id c7-20020a056402120700b00560c674e301si2267287edw.667.2024.02.19.02.10.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 19 Feb 2024 02:10:11 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-71096-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) client-ip=147.75.80.249; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-71096-ouuuleilei=gmail.com@vger.kernel.org designates 147.75.80.249 as permitted sender) smtp.mailfrom="linux-kernel+bounces-71096-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by am.mirrors.kernel.org (Postfix) with ESMTPS id B85A61F23420 for ; Mon, 19 Feb 2024 10:10:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 112F828E0F; Mon, 19 Feb 2024 10:09:36 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C8C95288DF for ; Mon, 19 Feb 2024 10:09:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708337374; cv=none; b=IAL17uBOiElTKYoFk/fs3sxhoicMgLsw2EahaOEkYT3tviN5cgrgIU4r2yYO6jNBoO0nGyeU8AOEx2KiCRl/+WhPgfWG6M1m+so80FiZpcUHYZ02Lf0j6iE5b/L+hXx/oS6PqQ0GLLb5F0tV0GPnZKfEo04bat54WeaZylp68ws= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708337374; c=relaxed/simple; bh=fPKK7lbxTJQg2HozRmLSmLdED3dVOb6syBUEw/ZUhuw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=BiDHcX/I48g/NRQVxrKtPyDMx+94iEOkJ8rUVjVI/gRm2vnzi7nok6Cdwl4TCuCP6ptJXwOrPPDEy0kSADeOwO38yTGy2hB8p5EM1g0FU0L0VPws0SB4y+2C2ETvewgpICNvJpa1eVDStDctHnsfRWIchLJa52yPah2Mhv7wI/I= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id D454E1FB; Mon, 19 Feb 2024 02:10:11 -0800 (PST) Received: from a077854.blr.arm.com (a077854.arm.com [10.162.41.80]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 5D45B3F762; Mon, 19 Feb 2024 02:09:29 -0800 (PST) From: Faiz Abbas To: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org Cc: liviu.dudau@arm.com, maarten.lankhorst@linux.intel.com, mripard@kernel.org, tzimmermann@suse.de, airlied@gmail.com, daniel@ffwll.ch, Faiz Abbas Subject: [PATCH 1/3] drm/arm/komeda: Fix komeda probe failing if there are no links in the secondary pipeline Date: Mon, 19 Feb 2024 15:39:13 +0530 Message-Id: <20240219100915.192475-2-faiz.abbas@arm.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20240219100915.192475-1-faiz.abbas@arm.com> References: <20240219100915.192475-1-faiz.abbas@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1791321609350856251 X-GMAIL-MSGID: 1791321609350856251 Since commit f7936d6beda9 ("drm/arm/komeda: Remove component framework and add a simple encoder"), the devm_drm_of_get_bridge() call happens regardless of whether any remote nodes are available on the pipeline. Fix this by moving the bridge attach to its own function and calling it conditional on there being an output link. Fixes: f7936d6beda9 ("drm/arm/komeda: Remove component framework and add a simple encoder") Signed-off-by: Faiz Abbas --- .../gpu/drm/arm/display/komeda/komeda_crtc.c | 43 ++++++++++++++----- 1 file changed, 32 insertions(+), 11 deletions(-) diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c index 2c661f28410e..b645c5998230 100644 --- a/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c +++ b/drivers/gpu/drm/arm/display/komeda/komeda_crtc.c @@ -5,6 +5,7 @@ * */ #include +#include #include #include @@ -610,12 +611,34 @@ get_crtc_primary(struct komeda_kms_dev *kms, struct komeda_crtc *crtc) return NULL; } +static int komeda_attach_bridge(struct device *dev, + struct komeda_pipeline *pipe, + struct drm_encoder *encoder) +{ + struct drm_bridge *bridge; + int err; + + bridge = devm_drm_of_get_bridge(dev, pipe->of_node, + KOMEDA_OF_PORT_OUTPUT, 0); + if (IS_ERR(bridge)) + return dev_err_probe(dev, PTR_ERR(bridge), "remote bridge not found for pipe: %s\n", + of_node_full_name(pipe->of_node)); + + err = drm_bridge_attach(encoder, bridge, NULL, 0); + if (err) + dev_err(dev, "bridge_attach() failed for pipe: %s\n", + of_node_full_name(pipe->of_node)); + + return err; +} + static int komeda_crtc_add(struct komeda_kms_dev *kms, struct komeda_crtc *kcrtc) { struct drm_crtc *crtc = &kcrtc->base; struct drm_device *base = &kms->base; - struct drm_bridge *bridge; + struct komeda_pipeline *pipe = kcrtc->master; + struct drm_encoder *encoder = &kcrtc->encoder; int err; err = drm_crtc_init_with_planes(base, crtc, @@ -626,27 +649,25 @@ static int komeda_crtc_add(struct komeda_kms_dev *kms, drm_crtc_helper_add(crtc, &komeda_crtc_helper_funcs); - crtc->port = kcrtc->master->of_output_port; + crtc->port = pipe->of_output_port; /* Construct an encoder for each pipeline and attach it to the remote * bridge */ kcrtc->encoder.possible_crtcs = drm_crtc_mask(crtc); - err = drm_simple_encoder_init(base, &kcrtc->encoder, - DRM_MODE_ENCODER_TMDS); + err = drm_simple_encoder_init(base, encoder, DRM_MODE_ENCODER_TMDS); if (err) return err; - bridge = devm_drm_of_get_bridge(base->dev, kcrtc->master->of_node, - KOMEDA_OF_PORT_OUTPUT, 0); - if (IS_ERR(bridge)) - return PTR_ERR(bridge); - - err = drm_bridge_attach(&kcrtc->encoder, bridge, NULL, 0); + if (pipe->of_output_links[0]) { + err = komeda_attach_bridge(base->dev, pipe, encoder); + if (err) + return err; + } drm_crtc_enable_color_mgmt(crtc, 0, true, KOMEDA_COLOR_LUT_SIZE); - return err; + return 0; } int komeda_kms_add_crtcs(struct komeda_kms_dev *kms, struct komeda_dev *mdev)