Received: by 2002:a89:d88:0:b0:1fa:5c73:8e2d with SMTP id eb8csp1698876lqb; Sun, 26 May 2024 13:00:00 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWWTvwWOZ+UPODjvvbHRj0e6DOwaH8s4XXp33U7HgjznlSP6ZSXGVeQniHjFqLNH3vyukFfUk5zhsCQbqXBHzi1DAhnpkAaH1XwhQs45g== X-Google-Smtp-Source: AGHT+IFnGPXoeVLOaChiHXHr0jNKWI7xvFcZkrrWmzTPK84lvzWOoUlbj7/zLCepTxKLddLhINJy X-Received: by 2002:a05:6a20:2447:b0:1af:f2a7:8120 with SMTP id adf61e73a8af0-1b212f341d1mr8927337637.48.1716753600639; Sun, 26 May 2024 13:00:00 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1716753600; cv=pass; d=google.com; s=arc-20160816; b=V+Xn46p5omP4OwBruSS3LW3aC4JXZaTtAGw8AO7NQVT3SfLu/kjiqrtvwsS71TaXGM 6ZEzSkUCx9zwDM1WUtNtf/JYkrQh8My16LJmwPTcCB57zxnj4WTJhzDhAJhpynPcM+lJ 4K8FcKX2GjFWuj+1DHfRaYm8jttyu+LlwIHgnh1JVoU0em5/7qOiMcN6N/JoiY5CNZjg tS845BQtztwQey70kEdbA1zDKGLDEHG7/dRS5yuu/+3kBZIR2jYizPNqmGcfMpcG6oLD LDOyV4fDV+qEP3iFLnQWMdXJ6Eg6fV++R/X0QeCRm6EWQ/w6bQjWzCXHO3WbCEH88TnC 3bcg== 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=vxl1w9mtqDkyZD04DnulPgGkGBzNIZLutabN9Rr9Q2I=; fh=FINt0rIw/rPodBwcJrqXwOg2bLb0oiIvvxMT3hhBbHU=; b=NIszpjxmm0m3Z573gHjy0AMfrLI02gAnrVoZNzfDDfDGg2IE7yIL49IROiGnDBsjzD abiV3P88ulcIw9UPAFZzTXkoMZi9oN/ul43El0liLCRIrdvtpPyvyJ2ovNqbSIDhkat/ KPd8bGs//v0tQqm4D5B1jI9n3HBdM8b30PT9f8RREzhbHkTQNAID0mVKiafwfQ7BxsnQ js2Wtrin3t9hxSopaQpfbnL1vzY8nAXu8+S1x0o7GTF430sg/Kmd0QQsLQOOBwpikWU2 5q4QlHMPHtDi28hyCpYQWg9NzRKJxXTVfTBK0g169IogR3msdWSshCr5dwg4Z4TEPaaq aF+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ECKxfimC; 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-189852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189852-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. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id 41be03b00d2f7-697cc893049si1805200a12.629.2024.05.26.13.00.00 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 26 May 2024 13:00:00 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-189852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@linux.dev header.s=key1 header.b=ECKxfimC; 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-189852-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-189852-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 5A498B20C5B for ; Sun, 26 May 2024 19:59:48 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 6471E1327F1; Sun, 26 May 2024 19:59:28 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=linux.dev header.i=@linux.dev header.b="ECKxfimC" Received: from out-184.mta0.migadu.com (out-184.mta0.migadu.com [91.218.175.184]) (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 A137D1327E7 for ; Sun, 26 May 2024 19:59:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=91.218.175.184 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716753566; cv=none; b=ozPChQelfYESbda/lQrEHjvJelqip60oQj2qlQM7Vd3QWocYBnrmIFBofBNS3bvqfH6TFOjyJ1kHpzI5du4FZRZH0Ewn6SsHi0K6b/+U0EKMo1Bym8451Kvyy9yNl8tRs+7j+WM6mtngkSDdf4Sv3pqwHlFSi0aq3U1sd5pHS08= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1716753566; c=relaxed/simple; bh=oJV5Gn4qR8Fwf6erj9lBXeDiakLyt8d4Q/i7c90tvBw=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=CBAdvNyesGV/5xr6XJfWyYkmi6XJQuRRDT1Te1YdGsymeekO4SV/SyaQa7NcXOLYKHcnEAR11bCUaMd3QnNNRehLBvXDx1bwkWkMUuJVv4bsiLPrALQU5Av+pOqzFGs+cQaxnZBAtI/nRz5+tpZvEcRTqsK7Azbggq2xfEYS3KQ= 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=ECKxfimC; arc=none smtp.client-ip=91.218.175.184 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-Envelope-To: maarten.lankhorst@linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux.dev; s=key1; t=1716753561; 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=vxl1w9mtqDkyZD04DnulPgGkGBzNIZLutabN9Rr9Q2I=; b=ECKxfimC7g/ZqW3qDT1fTw+i95pPXZ3ApwmUE12jcwSN+pQVcrTbYObO6X/kGHZwejw7u7 S23u2UxIjRlVn4rgpmZOCc/+rNJFPAn5lsGmZRXAZGoGj7gf/MV8GdJyIA7fZhol89TZVc nUzo6udPtguG8JeZR0tsWG6enwuPDFo= X-Envelope-To: mripard@kernel.org X-Envelope-To: tzimmermann@suse.de X-Envelope-To: linux-kernel@vger.kernel.org X-Envelope-To: dri-devel@lists.freedesktop.org X-Envelope-To: markus.elfring@web.de X-Envelope-To: sui.jingfeng@linux.dev X-Report-Abuse: Please report any abuse attempt to abuse@migadu.com and include these headers. From: Sui Jingfeng To: Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Markus Elfring , Sui Jingfeng Subject: [PATCH v2 2/3] drm/loongson: Introduce component framework support Date: Mon, 27 May 2024 03:58:25 +0800 Message-Id: <20240526195826.109008-3-sui.jingfeng@linux.dev> In-Reply-To: <20240526195826.109008-1-sui.jingfeng@linux.dev> References: <20240526195826.109008-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 Hardware units come with PCIe are actually all ready to be driven, but there has some board specific modules could return '-EPROBE_DEFER'. However, the driver needs all of the subcompoments ready to use before it can register the drm service to userspace. Introduce the component framework to tackle such problems, move DRM device related code into loongson_drm_master_bind() function. Move output related things into subdriver. Display controller and GPIO-I2C goes with the PCIe master, sinch they has no dependency on exterinal modules. While the outputs drivers, such as encoders and conectors, may has some dependency on exterinal modules. Those hardware units are relatively independent hardware IPs from the CRTC. Hence, offload them to submodules. This design allows subdriver return '-EPROBE_DEFER' to the driver core if it need to do so, the master drvier won't bind until all submodules are ready. 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 | 205 +++++++++++------- drivers/gpu/drm/loongson/lsdc_drv.h | 31 +-- drivers/gpu/drm/loongson/lsdc_i2c.c | 5 +- drivers/gpu/drm/loongson/lsdc_i2c.h | 3 - drivers/gpu/drm/loongson/lsdc_output.c | 176 +++++++++++++++ drivers/gpu/drm/loongson/lsdc_output.h | 38 +++- drivers/gpu/drm/loongson/lsdc_output_7a1000.c | 3 +- drivers/gpu/drm/loongson/lsdc_output_7a2000.c | 17 +- 11 files changed, 367 insertions(+), 130 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