Received: by 2002:ab2:6a05:0:b0:1f8:1780:a4ed with SMTP id w5csp1744686lqo; Sun, 12 May 2024 17:14:59 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWBqs7W9B+1//7Bmt3/+0qvdJHN6F7/cOwdWB8EOm9ZxvHOy+nevOYcvtXdNhAqWr8Wy6vTpvYdl9aR5XxB+7gZFf0K76oxSgHLdbQuCw== X-Google-Smtp-Source: AGHT+IFXeUpv2MK7Oh3NhVQmmftIaDeMfktdHl1um2B//RXf5IZ8G3l3klNbnq+odHWFSEXdmPHl X-Received: by 2002:a17:90b:354d:b0:2af:1d61:e65e with SMTP id 98e67ed59e1d1-2b6cc758e02mr5726854a91.17.1715559299392; Sun, 12 May 2024 17:14:59 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1715559299; cv=pass; d=google.com; s=arc-20160816; b=pStzveBetnwvtrMb6B1JPs7mjmX/VT/Kx+UhSnYOGZdycqE9h2rMopGc6nsXju2Lsi dW8GKR5tryaZnxR5snf9Vi5ltmpr+3gyD9KoWlQX1Ld+XRjDvqz4CmCua24QWSefy4KK yrDGj8WkbJu4Ahba841vKExaWRBjjZHmRei3FLJ+sMHX+ipspsWDarONAnE6BUfuKlBu GlpYTDoiEyArzHkK9ZJbA5U+nqLzftzUNpYofMe41nJyOP9i6WK2zfi78O/69ReEyPoz sTHP3O3eom9iNDRIuvYsuBwsIC6AMyE6J/5nY9ZjRuA5BBk3jyqDkCLGid3HFID/9Pg+ aeLw== 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:dkim-signature; bh=FosN8AJZZ0vwxsKhagS4hdt1OIJWrMoEgJv1L3If2Xc=; fh=NuGnp3yIX/lIaCrd+NjTmDZChMAGT+57wDSfP0XHwKE=; b=yUrZ6HGva1DViY8GWMS81d1BAg/lggvMh7SxZY43T0gkWbN8AhM5ilRmyZkgAZysM7 QTDkNywWRJceRCr92YzeGm5f/vKf6FELnUt/ibMf+CK8phgrGtfnghSC1llnioWlW4+F zR7r+TJXvJrZgmaAXRiO00jLt1GIF4gwnH9kkuIeXq+poqU5YdHc/KiaHb1+zYo51r5S K1JtV1DEo2pqnW7JJJX+d9A8fAklSiReGRWyLy2bCFBccafJeha52AWeUdoGn22XEUYS IynArpsA3FkZvStDe5aPuMA8NasdmVmiEKXMpcfc9ir7iGp4OI5aAYsRRoQtb6DVpyYp J32g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WTOYWcRX; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-177062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id 98e67ed59e1d1-2b67177e6b7si8068454a91.169.2024.05.12.17.14.58 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 12 May 2024 17:14:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-177062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=WTOYWcRX; arc=pass (i=1 spf=pass spfdomain=linux.dev dkim=pass dkdomain=linux.dev dmarc=pass fromdomain=linux.dev); spf=pass (google.com: domain of linux-kernel+bounces-177062-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-177062-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linux.dev 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id 99E54B20C7C for ; Mon, 13 May 2024 00:14:56 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 2D01580B; Mon, 13 May 2024 00:14:50 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="WTOYWcRX" Received: from out-181.mta0.migadu.com (out-181.mta0.migadu.com [91.218.175.181]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id A1B2917E for ; Mon, 13 May 2024 00:14:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.181 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715559289; cv=none; b=kov02nBgVW/86m5h1lqOJvCpUCTvnsmMcJWPFkqUpyLzY1XNpGG9k2Fv3aRK/LAwjFsi7nXP/9WeuPTqe4Vd1ZkMRIFHFlbliIla1Ky2OagxfQ5/PVFbwK8/gOolD81aFghyImGIVLJ4wdWF1OZzOMkBKsCC5b6sZKV6KkA5t/U= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1715559289; c=relaxed/simple; bh=6KXMmIO5xKqnb0dbgTwqYXgjGunpHacHh7hbzGT07V8=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=HcOGjIzwYf0P7vFZYkgW9dUrp1iBfP34jhxwOoUtSBFrJhchnlUWocgNS5wyQ76If3YHC+MpgKCvB2/OrPnGylmOCNGcQU3nrhb1u7A7qam2RKYfwIF7D8iTMt9gDwWdF2ZEJKri7k1qDYvgTyeY6lAHuLOygPwb2e/43bz3Fr0= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev; spf=pass smtp.mailfrom=linux.dev; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b=WTOYWcRX; arc=none smtp.client-ip=91.218.175.181 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.dev Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1715559284; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:cc:mime-version:mime-version: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=FosN8AJZZ0vwxsKhagS4hdt1OIJWrMoEgJv1L3If2Xc=; b=WTOYWcRXo2/DrRgqvmrfr2EhotGBYpufsq8/9YOnoqSVGjZ5WjWeRKMeeiq8X581oy/oOn WoTQNfpBh8cRQ5Q5fqIQuba54/7occZT2GfpBxsE6sqo89804hJybyZCaE9htN8a5qimPv BGGVf/uhT9CRwclxE0HJrYtoEs5gEd4= From: Sui Jingfeng To: Maxime Ripard , Thomas Zimmermann Cc: Sui Jingfeng , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Sui Jingfeng Subject: [PATCH 2/3] drm/loongson: Introduce component framework support Date: Mon, 13 May 2024 08:12:42 +0800 Message-Id: <20240513001243.1739336-3-sui.jingfeng@linux.dev> In-Reply-To: <20240513001243.1739336-1-sui.jingfeng@linux.dev> References: <20240513001243.1739336-1-sui.jingfeng@linux.dev> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Migadu-Flow: FLOW_OUT Introduce the component framework to bind childs and siblings, for better modularity and paper over the deferral probe problems if it need to attach exterinal module someday. Hardware units come with PCI(e) are actually all ready to drive, but there has some board specific modules will return -EPROBE_DEFER. We need all other submodules ready to attach before we can register the drm device to userspace. The idea is to devide the exterinal module dependent part and exterinal module independent part clearly, for example, the display controller and the builtin GPIO-I2C just belong to exterinal module independent part. While the output is belong to exterinal module dependent part. Also for better reflecting the hardware, we intend to abstract the output ports as child devices. The output ports may consists of encoder phy and level shift, while the GPU and VPU are standalone siblings. As those units are relative separate hardware units from display controller itself. By design, the display controller PCI(e) is selected as the component master, gpio-i2c go with master. The manually created virtual child device are functional as agents for the master, it could return the -EPROBE_DEFER back to the component core. This allows the master don't have to tear down everything, the majority setups work can be preserved. The potential cyclic dependency problem can be solved with such framework. Signed-off-by: Sui Jingfeng --- drivers/gpu/drm/loongson/Makefile | 1 + drivers/gpu/drm/loongson/loongson_module.c | 17 ++- drivers/gpu/drm/loongson/loongson_module.h | 1 + drivers/gpu/drm/loongson/lsdc_drv.c | 59 +++++++++ drivers/gpu/drm/loongson/lsdc_drv.h | 6 +- drivers/gpu/drm/loongson/lsdc_output.c | 142 +++++++++++++++++++++ drivers/gpu/drm/loongson/lsdc_output.h | 22 +++- 7 files changed, 241 insertions(+), 7 deletions(-) create mode 100644 drivers/gpu/drm/loongson/lsdc_output.c diff --git a/drivers/gpu/drm/loongson/Makefile b/drivers/gpu/drm/loongson/Makefile index 91e72bd900c1..e15cb9bff378 100644 --- a/drivers/gpu/drm/loongson/Makefile +++ b/drivers/gpu/drm/loongson/Makefile @@ -9,6 +9,7 @@ loongson-y := \ lsdc_gfxpll.o \ lsdc_i2c.o \ lsdc_irq.o \ + lsdc_output.o \ lsdc_output_7a1000.o \ lsdc_output_7a2000.o \ lsdc_plane.o \ diff --git a/drivers/gpu/drm/loongson/loongson_module.c b/drivers/gpu/drm/loongson/loongson_module.c index d2a51bd395f6..037fa7ffe9c9 100644 --- a/drivers/gpu/drm/loongson/loongson_module.c +++ b/drivers/gpu/drm/loongson/loongson_module.c @@ -4,6 +4,7 @@ */ #include +#include #include