From patchwork Thu Dec 3 08:24:45 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Hsin-Yi Wang X-Patchwork-Id: 11948209 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.2 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6BB39C64E7B for ; Thu, 3 Dec 2020 08:26:22 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id EA41B21527 for ; Thu, 3 Dec 2020 08:26:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org EA41B21527 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=chromium.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:Message-Id:Date:Subject:To:From: Reply-To:Content-ID:Content-Description:Resent-Date:Resent-From:Resent-Sender :Resent-To:Resent-Cc:Resent-Message-ID:In-Reply-To:References:List-Owner; bh=inD6fma4OtmhjlhnM5EZeZT6PKeq17p5eIglCGl41z4=; b=DrIJHfZEMInwJshgxaOTtvUC+U K5zJ0LxcRABd55jHeFqL1bF7XWDPJK38kio0cWb3RDh6XLI9tNvhfWylrs2NmHHkQWAQi4gZ7tlPX Nx/21BP24A+JUpdwvHJE7rtBe+BpuXRhKQnWFe1R/dmEzEXUEVsdpjIvG+ZeoEChMZjWq6vbvoQvJ vp+vjfzSFwuvzJPbfXxl8s90GtYLCeLAx67cLh9duqinoIobvVgomdMZyhpoIlhjFcMJDvjOX2t6u l/DGAdJnS+GXkFy0zZ2d6VIQhmg/mrK9jrjot4bl5GBFwCbO9UEjoFRfJUFsmtofo97veoTl7HALq yCQqJP/Q==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkjvC-0003PV-VB; Thu, 03 Dec 2020 08:25:03 +0000 Received: from mail-pf1-x441.google.com ([2607:f8b0:4864:20::441]) by merlin.infradead.org with esmtps (Exim 4.92.3 #3 (Red Hat Linux)) id 1kkjv9-0003O7-UG for linux-arm-kernel@lists.infradead.org; Thu, 03 Dec 2020 08:25:00 +0000 Received: by mail-pf1-x441.google.com with SMTP id w187so796942pfd.5 for ; Thu, 03 Dec 2020 00:24:57 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbfQj5yx8q5vsWWQ52FX9cwcSvHIrWrBDYdeg/Q55J4=; b=CC0LDk6MjaniNohllz1X8vF+6zibKnjaUx1UZusXT8g4PvOPFVhlFnPKG5iMoMlTes VZTT3FxsHMM0NAZJHNq0pIWQpyPcuO/f5V8263/cLsUcUPTOxTEQNcq++aIVashDczax rbeUvp4tBFyvoD4jU7tuyRCmjYopbPDK7mfuo= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:mime-version :content-transfer-encoding; bh=ZbfQj5yx8q5vsWWQ52FX9cwcSvHIrWrBDYdeg/Q55J4=; b=pQIzDEctoLkqhSeQ7ThVywpUAtkRNuoHntNwOqIkKzYB4SMQDLu5kAm4QYdCzJuKay JH6+qickZGvv3RIKGEI1+q46GNVN/CJWOUyDnA4U8Zwv4KTh3hd19RBNZ0T8yKrbYUYQ zdeMxKW0+5P+VejvGc3B0wrya0Kx8fUqX/xEAmUIX79seOIrE7is3yRFTNolo96Pwf4B pfdNYbgq5eypnI/EwonCf1tNbS1XW+De1+LfamQ6rpISg0RyL2xGmT6xQdjOq2I0+OTj LAw+6VfeQt6fSRQLeJ1euPAxApyImVAcnk6jdueCpfkqKhI149iAI2EUfU0oGPBYTppv OxeQ== X-Gm-Message-State: AOAM5304GajGOGrAFUCGPY6GkXdVo36GDoo785gSztN/0hix+Nt4f0++ jYrC+RFtLwVsfvd5GDicFaqi7g== X-Google-Smtp-Source: ABdhPJwD4kYBEvN44OH+eyu4iXyYp+S5tYey6LADtEcblFq79I2Cyce9ZL7pLKKrJ1KH9iN4MWofgw== X-Received: by 2002:a62:a11a:0:b029:18a:df9e:f537 with SMTP id b26-20020a62a11a0000b029018adf9ef537mr2173912pff.29.1606983893429; Thu, 03 Dec 2020 00:24:53 -0800 (PST) Received: from hsinyi-z840.tpe.corp.google.com ([2401:fa00:1:10:1a60:24ff:fe89:3e93]) by smtp.gmail.com with ESMTPSA id e66sm815128pfe.165.2020.12.03.00.24.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Dec 2020 00:24:52 -0800 (PST) From: Hsin-Yi Wang To: Chun-Kuang Hu Subject: [PATCH] drm/mediatek: mtk_dpi: Create connector for bridges Date: Thu, 3 Dec 2020 16:24:45 +0800 Message-Id: <20201203082445.1342763-1-hsinyi@chromium.org> X-Mailer: git-send-email 2.29.2.576.ga3fc446d84-goog MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201203_032500_015333_588F38F3 X-CRM114-Status: GOOD ( 16.94 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Philipp Zabel , David Airlie , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Matthias Brugger , linux-mediatek@lists.infradead.org, Daniel Vetter , Enric Balletbo i Serra , linux-arm-kernel@lists.infradead.org Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Similar to a9d9fea74be2 ("drm/mediatek: mtk_dsi: Create connector for bridges"): Use the drm_bridge_connector helper to create a connector for pipelines that use drm_bridge. This allows splitting connector operations across multiple bridges when necessary, instead of having the last bridge in the chain creating the connector and handling all connector operations internally. Signed-off-by: Hsin-Yi Wang Reviewed-by: Chun-Kuang Hu --- drivers/gpu/drm/mediatek/mtk_dpi.c | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/mediatek/mtk_dpi.c b/drivers/gpu/drm/mediatek/mtk_dpi.c index 52f11a63a330..189377e342fa 100644 --- a/drivers/gpu/drm/mediatek/mtk_dpi.c +++ b/drivers/gpu/drm/mediatek/mtk_dpi.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -66,6 +67,7 @@ struct mtk_dpi { struct drm_encoder encoder; struct drm_bridge bridge; struct drm_bridge *next_bridge; + struct drm_connector *connector; void __iomem *regs; struct device *dev; struct clk *engine_clk; @@ -603,12 +605,21 @@ static int mtk_dpi_bind(struct device *dev, struct device *master, void *data) dpi->encoder.possible_crtcs = mtk_drm_find_possible_crtc_by_comp(drm_dev, dpi->ddp_comp); - ret = drm_bridge_attach(&dpi->encoder, &dpi->bridge, NULL, 0); + ret = drm_bridge_attach(&dpi->encoder, &dpi->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); if (ret) { dev_err(dev, "Failed to attach bridge: %d\n", ret); goto err_cleanup; } + dpi->connector = drm_bridge_connector_init(drm_dev, &dpi->encoder); + if (IS_ERR(dpi->connector)) { + dev_err(dev, "Unable to create bridge connector\n"); + ret = PTR_ERR(dpi->connector); + goto err_cleanup; + } + drm_connector_attach_encoder(dpi->connector, &dpi->encoder); + dpi->bit_num = MTK_DPI_OUT_BIT_NUM_8BITS; dpi->channel_swap = MTK_DPI_OUT_CHANNEL_SWAP_RGB; dpi->yc_map = MTK_DPI_OUT_YC_MAP_RGB;