From patchwork Sun Mar 31 20:29:05 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Baryshkov X-Patchwork-Id: 13612294 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 03F14CD128A for ; Sun, 31 Mar 2024 20:30:09 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:Cc:To:In-Reply-To:References:Message-Id :MIME-Version:Subject:Date:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=jVb2bb8ZlfwQOhJWIliic6UxJ6jHLKWJlAJvfud0rF0=; b=N9wOyJJGEInu4h kl8o5XSWncPYJqJm/JsqafpOLgxAwZO8N9ABAt3vt651H1XgnzhlajEBhmi8m4NhqwFlAMK921pmn +wqWsCR8l++YwkSszeTMwrpCkkMpX6tIw6FKFYn9UlffiVwrj+04r2eFw6YQuL/ZaD9U9TNVDyeLn Z79/F+M63OWQsUROhgVLkbI6u6F1IofRVDOHRX1W8Ecom7t8aS2aljCW6wIG30SvlVKt1F4PPYO8i 9CkJKdr6Z4ES1gUaCs8Z0Bo8MaKcwCHRGo7Gg1vYWloccBLPTNZ8xt9Ri+VNUSDgHnL0aEa22Vdxi 1occIhLKcuHUTvXVxE5g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.97.1 #2 (Red Hat Linux)) id 1rr1oW-00000006GGV-0fAP; Sun, 31 Mar 2024 20:30:00 +0000 Received: from mail-lf1-x131.google.com ([2a00:1450:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.97.1 #2 (Red Hat Linux)) id 1rr1nl-00000006FqZ-3qzr for linux-arm-kernel@lists.infradead.org; Sun, 31 Mar 2024 20:29:17 +0000 Received: by mail-lf1-x131.google.com with SMTP id 2adb3069b0e04-515d49a6b4cso1545723e87.0 for ; Sun, 31 Mar 2024 13:29:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; t=1711916952; x=1712521752; darn=lists.infradead.org; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:from:to:cc:subject:date:message-id :reply-to; bh=2NWUO8Sy6JPSgwKkrutWi5HBoELv9lWKNmrIdWaVqOA=; b=L41HcnX1KJRdNiwu0C/7cG0djwZ1aNHecFwtuJ2TWiu9f9NRNz5hOwQItB/gcjo8Vd xXygi3OrKfrVaZej6CIZ19hoXnP8XrUfE0KeY//2BcgXRepK3kL65FHOraiTdAvOy14U cuxNX1ooSfy2LUkBx8ZzUQlzfaRHr8uBlu85ZM659xlz7iJecg0ePl8GVibs5AGqigwW CHawhCeyo7MDbU+Jlc5WFjtV/kW26FBCMBL49Tno1BHvnbmJhqQlLPRSKbM41sMH3sLS RsIBGvOWdQhd6MN/5wkKFeAZh+as93aRzG6ebNYV1xTAKAI8BrYxlQLQZilbH9jUciyI Eu9g== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1711916952; x=1712521752; h=cc:to:in-reply-to:references:message-id:content-transfer-encoding :mime-version:subject:date:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=2NWUO8Sy6JPSgwKkrutWi5HBoELv9lWKNmrIdWaVqOA=; b=d1MGcVIeksR4NoC35QGkRCjBrSsykgjjD2sosG3yS41yod3bN/p9ysM5aHRRMNl8aq IbtLTWjzZG3Pa6R1pj4/FhXMQ/x3qWASR+Ez9llLyihlXszsYa59nZPof7tknE3RFKJM APZ+Y0wDsszgcpaE2KYMeN6BIF4uU4pZxKnXAS8nKi5dVEGTU4hP6ciaJ5X7ts4DRfFj NgP1X3AmMBmLYttr4LJBr64cjWgUjcTajD6PtdDur4ubOlFwtF3czMfuLgmy4bMXasWN Pvbnn6BnyQlgY4zVtEpPFlQ8zPXn6VgVLNxdp9T3uoMjejreMhrLssANRV7kYdGMRUsT eysQ== X-Forwarded-Encrypted: i=1; AJvYcCX3kLoRbgtE9W030MruiU6C6YRKIkUO9h7JmnaPhY/H2xlUOVd3B31XYtyrvRZei7tjMkx0emzkUAegUjenP2B3bWTJA0TdL+KHNyyQBU4dNk9ABdM= X-Gm-Message-State: AOJu0YxicTT/gJNCvp0UC4P5wA8hZTVKSWDiTLWzaZLcGX7h5pmCM+CE fX7C1sAWEh9nt7BRS5LFXgNYFyHdWwpzTnEyKI2fr1wU+OSfhbXFnf+3KuKTznw= X-Google-Smtp-Source: AGHT+IF/gwVAQwbfxLT+LCIBhCaRg+FxT10/Jh8nnHOQd/9xJ4bySdg9cI4XUR3gXC85ea19gCneCg== X-Received: by 2002:ac2:5eca:0:b0:513:da24:fc0b with SMTP id d10-20020ac25eca000000b00513da24fc0bmr5142760lfq.33.1711916952439; Sun, 31 Mar 2024 13:29:12 -0700 (PDT) Received: from umbar.lan ([192.130.178.91]) by smtp.gmail.com with ESMTPSA id y25-20020a197519000000b00513cfc2a7aesm1237276lfe.71.2024.03.31.13.29.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 31 Mar 2024 13:29:12 -0700 (PDT) From: Dmitry Baryshkov Date: Sun, 31 Mar 2024 23:29:05 +0300 Subject: [PATCH v2 08/12] drm/imx: parallel-display: switch to drm_panel_bridge MIME-Version: 1.0 Message-Id: <20240331-drm-imx-cleanup-v2-8-d81c1d1c1026@linaro.org> References: <20240331-drm-imx-cleanup-v2-0-d81c1d1c1026@linaro.org> In-Reply-To: <20240331-drm-imx-cleanup-v2-0-d81c1d1c1026@linaro.org> To: Philipp Zabel , David Airlie , Daniel Vetter , Maarten Lankhorst , Maxime Ripard , Thomas Zimmermann , Rob Herring , Krzysztof Kozlowski , Conor Dooley , Shawn Guo , Sascha Hauer , Pengutronix Kernel Team , Fabio Estevam Cc: Chris Healy , dri-devel@lists.freedesktop.org, devicetree@vger.kernel.org, imx@lists.linux.dev, linux-arm-kernel@lists.infradead.org, Dmitry Baryshkov X-Mailer: b4 0.13.0 X-Developer-Signature: v=1; a=openpgp-sha256; l=3282; i=dmitry.baryshkov@linaro.org; h=from:subject:message-id; bh=Pi9W5qgy4T7+J9hP9AVFepGfzI8GpfyO2Ku1B6h2Uks=; b=owEBbQGS/pANAwAKAYs8ij4CKSjVAcsmYgBmCceP58j4g6V4EltAY/XhET22h9ioI6gibKjLi hKvmJUXjKqJATMEAAEKAB0WIQRMcISVXLJjVvC4lX+LPIo+Aiko1QUCZgnHjwAKCRCLPIo+Aiko 1fEiB/9T1bnL+hT0p34ArbfJieqfBkbDb+2ZxrhzWsW6faJ9TPDPbi2BzBS5OVUPiLcj9/oAVew /tn/sGqoEGOrF92bR61BAKbHftzP4+5SrFsr6Az/ZTxsw8hYvyNlf/YjqwX85Nl4wOhEnropG5o C9/wgT79YfIvzN+jlMN7yADPKHiBB9DiOXD40bvqfBbo1Upf9KyzvmFWAt2/wCTOSxdnYWiU0xv Wg0CMH8K4178p8BkPwC613/e3u/SjQ5p9KokbOBMozXM2iFmrq84hPXGrVFZm+Xx1aALV34Sd6k 3TrVuFLbRtilldWxJFk6JBv6d0pyObAZDTv33enq71W6La0x X-Developer-Key: i=dmitry.baryshkov@linaro.org; a=openpgp; fpr=8F88381DD5C873E4AE487DA5199BF1243632046A X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20240331_132914_433838_B8E99E1E X-CRM114-Status: GOOD ( 15.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org Defer panel handling to drm_panel_bridge, unifying codepaths for the panel and bridge cases. Signed-off-by: Dmitry Baryshkov --- drivers/gpu/drm/imx/ipuv3/Kconfig | 2 ++ drivers/gpu/drm/imx/ipuv3/parallel-display.c | 35 +++++++--------------------- 2 files changed, 10 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/imx/ipuv3/Kconfig b/drivers/gpu/drm/imx/ipuv3/Kconfig index 4e41611c8532..8aaf2441bcef 100644 --- a/drivers/gpu/drm/imx/ipuv3/Kconfig +++ b/drivers/gpu/drm/imx/ipuv3/Kconfig @@ -13,6 +13,8 @@ config DRM_IMX_PARALLEL_DISPLAY tristate "Support for parallel displays" select DRM_PANEL depends on DRM_IMX + depends on DRM_BRIDGE + select DRM_PANEL_BRIDGE select VIDEOMODE_HELPERS config DRM_IMX_TVE diff --git a/drivers/gpu/drm/imx/ipuv3/parallel-display.c b/drivers/gpu/drm/imx/ipuv3/parallel-display.c index 4d17fb96e77c..b7743b30475a 100644 --- a/drivers/gpu/drm/imx/ipuv3/parallel-display.c +++ b/drivers/gpu/drm/imx/ipuv3/parallel-display.c @@ -36,7 +36,6 @@ struct imx_parallel_display { u32 bus_format; u32 bus_flags; struct drm_display_mode mode; - struct drm_panel *panel; struct drm_bridge *next_bridge; }; @@ -56,10 +55,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) struct device_node *np = imxpd->dev->of_node; int num_modes; - num_modes = drm_panel_get_modes(imxpd->panel, connector); - if (num_modes > 0) - return num_modes; - if (np) { struct drm_display_mode *mode = drm_mode_create(connector->dev); int ret; @@ -84,22 +79,6 @@ static int imx_pd_connector_get_modes(struct drm_connector *connector) return num_modes; } -static void imx_pd_bridge_enable(struct drm_bridge *bridge) -{ - struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); - - drm_panel_prepare(imxpd->panel); - drm_panel_enable(imxpd->panel); -} - -static void imx_pd_bridge_disable(struct drm_bridge *bridge) -{ - struct imx_parallel_display *imxpd = bridge_to_imxpd(bridge); - - drm_panel_disable(imxpd->panel); - drm_panel_unprepare(imxpd->panel); -} - static const u32 imx_pd_bus_fmts[] = { MEDIA_BUS_FMT_RGB888_1X24, MEDIA_BUS_FMT_BGR888_1X24, @@ -237,8 +216,6 @@ static const struct drm_connector_helper_funcs imx_pd_connector_helper_funcs = { }; static const struct drm_bridge_funcs imx_pd_bridge_funcs = { - .enable = imx_pd_bridge_enable, - .disable = imx_pd_bridge_disable, .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, @@ -315,10 +292,14 @@ static int imx_pd_probe(struct platform_device *pdev) return -ENOMEM; /* port@1 is the output port */ - ret = drm_of_find_panel_or_bridge(np, 1, 0, &imxpd->panel, - &imxpd->next_bridge); - if (ret && ret != -ENODEV) - return ret; + imxpd->next_bridge = devm_drm_of_get_bridge(dev, np, 1, 0); + if (IS_ERR(imxpd->next_bridge)) { + ret = PTR_ERR(imxpd->next_bridge); + if (ret != -ENODEV) + return ret; + + imxpd->next_bridge = NULL; + } ret = of_property_read_string(np, "interface-pix-fmt", &fmt); if (!ret) {