From patchwork Sun Feb 14 19:40:56 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087395 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=-13.8 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,UNWANTED_LANGUAGE_BODY, URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 D31C8C433DB for ; Sun, 14 Feb 2021 19:41:25 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 854F164DC3 for ; Sun, 14 Feb 2021 19:41:25 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 854F164DC3 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CC2E46E0A0; Sun, 14 Feb 2021 19:41:23 +0000 (UTC) Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by gabe.freedesktop.org (Postfix) with ESMTPS id F03C06E0A0 for ; Sun, 14 Feb 2021 19:41:22 +0000 (UTC) Received: by mail-pj1-x1030.google.com with SMTP id nm1so2483852pjb.3 for ; Sun, 14 Feb 2021 11:41:22 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WI1iyrnvhWaNG/MvFsahwpBXf2DTPnogdw12xoDU1G0=; b=EVG43J4/EO4+pGlO0g6kGGmKnxCMV3wq1NjNbFjH7MFbJIqAUh55QKyHyORwlFS1QQ A/JhHhwLujRXfD3v9erPMAy2OZw7EQ942OvjnvGGBD8XS31lM1THGlcSgzh7mi3R96Lm DnZ6I6nmeBuaUaOMGAA7101hvQTmV6ogOlTzE= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=WI1iyrnvhWaNG/MvFsahwpBXf2DTPnogdw12xoDU1G0=; b=ODnYwgPUkZRwLaOX5+ScqGxfyzJx8VN/z6HHfu0elGSsxGga9IkSn9xJkA3H75d45E ZpqVh0hbL2glGqflSvqjsatbWqS/6VsSKjgadxiKMaTi3EKaR13qrq+cbvWr//1cAehR ZF2aUr/2yckn/D3/drjsvL6IE85N+1HRGeunontUjhGwf8p3xaXuWkVazAzVlsdXcqym bM2RhCoMpNa7aI6WIi/arZBoIqPUUHIcUT3jOXQDFBsw0T98Vp3hk4afp0SUv1FB4qoq ffx5e5zcFnZWFjCUOoDEQHKbrMUXd9ojem38ZUUDG/6lCm+f77rt/qh2n2Um8HAXtYST RvrQ== X-Gm-Message-State: AOAM531oN/zzQVQTX/vQm/SVrXJ7LvZUl85BUZwm8B+t5UIqfBTcU0Pm lZ2oXRq+2MrKasXs3DmCyNqAfw== X-Google-Smtp-Source: ABdhPJzOmjjDGQgqnxXklOvSXjd4BguDUqqil0xk86snbbpR/yGMkUu7WGUp4pAFWbPilT+STILTGw== X-Received: by 2002:a17:90a:7e94:: with SMTP id j20mr12988495pjl.8.1613331682653; Sun, 14 Feb 2021 11:41:22 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:22 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 1/7] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge Date: Mon, 15 Feb 2021 01:10:56 +0530 Message-Id: <20210214194102.126146-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Replace of_drm_find_panel with drm_of_find_panel_or_bridge for finding panel, this indeed help to find the bridge if bridge support added. Added NULL in bridge argument, same will replace with bridge parameter once bridge supported. Signed-off-by: Jagan Teki --- Changes for v3: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 4f5efcace68e..2e9e7b2d4145 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -21,6 +21,7 @@ #include #include +#include #include #include #include @@ -963,10 +964,14 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - struct drm_panel *panel = of_drm_find_panel(device->dev.of_node); + struct drm_panel *panel; + int ret; + + ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0, + &panel, NULL); + if (ret) + return ret; - if (IS_ERR(panel)) - return PTR_ERR(panel); if (!dsi->drm || !dsi->drm->registered) return -EPROBE_DEFER; From patchwork Sun Feb 14 19:40:57 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087397 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 A911FC433DB for ; Sun, 14 Feb 2021 19:41:29 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6C4C7601FD for ; Sun, 14 Feb 2021 19:41:29 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6C4C7601FD Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CF3646E094; Sun, 14 Feb 2021 19:41:28 +0000 (UTC) Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6D2206E094 for ; Sun, 14 Feb 2021 19:41:27 +0000 (UTC) Received: by mail-pj1-x1035.google.com with SMTP id z9so2613886pjl.5 for ; Sun, 14 Feb 2021 11:41:27 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=8WZPMnqVXps+lPno6HH29XofDRK8cGk3vtrNY/1y3YY=; b=kFSNtSVX/9Qv2bIkNFV++AVP0nkqI+cc9EHdDg0PlhQmMwSTZ1BhpkglzpmTgYz/zH NlxRFdynr7OBoW6qqiI+YLRnhjRW4zshCErSGK1wtcf/sdGXNIoHeROQ6c66i8RftGQD jEsGYR+v9T52a11C+iTNg/l6jYzuNL/RwPlPM= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=8WZPMnqVXps+lPno6HH29XofDRK8cGk3vtrNY/1y3YY=; b=HLyaEe5tKxTLaTGRVw2p8VtzZTfQSfkmPS00LS2t4bkVJng5J87rmVRTdGvmYd/BE5 ZeeeD/kKUHZjQ3bJWBt+BV2oIBibKPFohmh+VFrAzOtWRHkvsE3V6S7f7ykVfqfp1/QX qRKKH+IJ2iNy/KHdFBhg0rhi6/ukZFbuvMXid3bSIgaNbskoGqF5Fc+7hKXgk0hx9ZBv FNbcVh8AQMY6p6Sul0pqZlXcAnYMPWhI9Xa3hXVtWTJzNeB1vIvCOs3TLIxuP/4jquZF wYQn+b71ruwtS5Ya0qmpPWpW010nLE3vKkExDaUNi+5X11uK4DrFM/L00/+eiy4rEuxh uHew== X-Gm-Message-State: AOAM533EswG3m0QslmKMd1kOX/dmjuT1JHr2AUCMRUgwj7JahMdqT0cK oG0Uu41t8G+NFPUA/eA4EgYToA== X-Google-Smtp-Source: ABdhPJy1dx9CAbEewuwblQXsakhtnMJqea774EloTB5iaaa2mRAoGLCbBSR3NnhDVFg+Jn8I6uin6g== X-Received: by 2002:a17:90a:fe09:: with SMTP id ck9mr12857176pjb.67.1613331687102; Sun, 14 Feb 2021 11:41:27 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:26 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 2/7] drm: sun4i: dsi: Add bridge support Date: Mon, 15 Feb 2021 01:10:57 +0530 Message-Id: <20210214194102.126146-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Samuel Holland , linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Some display panels would come up with a non-DSI output which can have an option to connect DSI interface by means of bridge converter. This DSI to non-DSI bridge converter would require a bridge driver that would communicate the DSI controller for bridge functionalities. So, add support for bridge functionalities in Allwinner DSI controller. Cc: Samuel Holland Signed-off-by: Jagan Teki --- Note: Samuel Holland, The existing kms hotplug dropped in order to attach the bridge properly. However, I did try several ways to support hotplug with the bridge but it's resulting in a deadlock where bind never attach bridge until bridge pointer found and bridge pointer cannot found until bind finishes. Any inputs on this would be appreciated. Changes for v3: - updated with new API's drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 34 +++++++++++++++++--------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 2 +- 2 files changed, 23 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 2e9e7b2d4145..39321299dc27 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -773,6 +773,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (dsi->panel) drm_panel_prepare(dsi->panel); + if (dsi->panel_bridge) + dsi->panel_bridge->funcs->pre_enable(dsi->panel_bridge); + /* * FIXME: This should be moved after the switch to HS mode. * @@ -788,6 +791,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (dsi->panel) drm_panel_enable(dsi->panel); + if (dsi->panel_bridge) + dsi->panel_bridge->funcs->enable(dsi->panel_bridge); + sun6i_dsi_start(dsi, DSI_START_HSC); udelay(1000); @@ -804,6 +810,9 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) if (dsi->panel) { drm_panel_disable(dsi->panel); drm_panel_unprepare(dsi->panel); + } else if (dsi->panel_bridge) { + dsi->panel_bridge->funcs->disable(dsi->panel_bridge); + dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); } phy_power_off(dsi->dphy); @@ -964,23 +973,17 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - struct drm_panel *panel; int ret; ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0, - &panel, NULL); + &dsi->panel, &dsi->panel_bridge); if (ret) return ret; - if (!dsi->drm || !dsi->drm->registered) - return -EPROBE_DEFER; - - dsi->panel = panel; dsi->device = device; - drm_kms_helper_hotplug_event(dsi->drm); - - dev_info(host->dev, "Attached device %s\n", device->name); + dev_info(host->dev, "Attached %s %s\n", + device->name, dsi->panel ? "panel" : "bridge"); return 0; } @@ -991,9 +994,10 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); dsi->panel = NULL; + dsi->panel_bridge = NULL; dsi->device = NULL; - drm_kms_helper_hotplug_event(dsi->drm); + drm_of_panel_bridge_remove(dsi->dev->of_node, 0, 0); return 0; } @@ -1082,7 +1086,13 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - dsi->drm = drm; + if (dsi->panel_bridge) { + ret = drm_bridge_attach(&dsi->encoder, dsi->panel_bridge, NULL, 0); + if (ret) { + dev_err(dsi->dev, "Couldn't attach drm bridge\n"); + goto err_cleanup_connector; + } + } return 0; @@ -1096,7 +1106,7 @@ static void sun6i_dsi_unbind(struct device *dev, struct device *master, { struct sun6i_dsi *dsi = dev_get_drvdata(dev); - dsi->drm = NULL; + drm_encoder_cleanup(&dsi->encoder); } static const struct component_ops sun6i_dsi_ops = { diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index c863900ae3b4..370ecb356a63 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -29,8 +29,8 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; - struct drm_device *drm; struct drm_panel *panel; + struct drm_bridge *panel_bridge; }; static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) From patchwork Sun Feb 14 19:40:58 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087399 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 B0D34C433E0 for ; Sun, 14 Feb 2021 19:41:33 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 793C164DBA for ; Sun, 14 Feb 2021 19:41:33 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 793C164DBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 049446E0AB; Sun, 14 Feb 2021 19:41:33 +0000 (UTC) Received: from mail-pl1-x635.google.com (mail-pl1-x635.google.com [IPv6:2607:f8b0:4864:20::635]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6DC8C6E0AC for ; Sun, 14 Feb 2021 19:41:31 +0000 (UTC) Received: by mail-pl1-x635.google.com with SMTP id e9so2553905plh.3 for ; Sun, 14 Feb 2021 11:41:31 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=bf5bVF/V5mY1BZUCCppx1dZ4tCXtGjp23rohASbcBPw=; b=EgPf4vqR/zBJ4fhi76+l20KOIlr0QjBN013wIMcoM2wiR4tPdkayZ9w+h6vCZOgY8X F+FEWS1k/va/bp9VhfDwmEiDZjTQO8dwfTYvk65ttsYs/Z1FY529PkCSH3PVcDdR8He4 cneko4X96/vWJo+LiwzTmV7V2huwgLkpzEUe0= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=bf5bVF/V5mY1BZUCCppx1dZ4tCXtGjp23rohASbcBPw=; b=YPLusMrVnaTc+NPyMLKyJEMrqfrD8sUFxnw6r0LMhUJfEf/3q51bbqIKP99WBNoK5K 09t6nMtR5grk4jlbqajH64IZ4uZTxFpCxpWzGnNKI/DOomtO50ixcjXKJbvam77kBJ0i QNm/EyecsnuI5m5lsKOm2RnfqiUa9RJcAPbWC9N2vfkHAmve2kYS6hgv6TTw3eWX5Kgx C2rlnpIo/BKp2MPpo890BOZ9a7kKcFBBrXvFz4zS5+5MCyKX8xtqqNe7tzIi0VN/rMtX 7/6C+2QuvRaFbR5NjlU2PVVoq8PKHBtyMuG5KK9MFFDLDrckkJQYlLdS7PU9dBSgkiJ2 Cf7Q== X-Gm-Message-State: AOAM530fKj1ew9eUp+U1hcD1HB8sWbyKwjCMOD+bNIuZhZbDH+3qTumK ZRCXYoWqO8lLWzLyJFnkqLwtmA== X-Google-Smtp-Source: ABdhPJwPwCNcwlAUsWS5/+FaZxoXxf/8pEHUEP2jFGuMeLBc4DXzF+O4eU7ry1PqloOvnMYMZfP4Xw== X-Received: by 2002:a17:90a:1b6c:: with SMTP id q99mr12487478pjq.137.1613331691135; Sun, 14 Feb 2021 11:41:31 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:30 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 3/7] drm: sun4i: dsi: Convert to bridge driver Date: Mon, 15 Feb 2021 01:10:58 +0530 Message-Id: <20210214194102.126146-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" DRM bridge drivers have build-in handling of treating all display pipeline components as bridges. So, convert the existing to a drm bridge driver with a built-in encoder support for compatibility with existing component drivers. Signed-off-by: Jagan Teki --- Changes for v3: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 75 ++++++++++++++++---------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 6 +++ 2 files changed, 54 insertions(+), 27 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 39321299dc27..6f3c5330a468 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -714,10 +714,10 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, return 0; } -static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) +static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; @@ -801,9 +801,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) sun6i_dsi_start(dsi, DSI_START_HSD); } -static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) +static void sun6i_dsi_bridge_disable(struct drm_bridge *bridge) { - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); DRM_DEBUG_DRIVER("Disabling DSI output\n"); @@ -852,9 +852,40 @@ static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; -static const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = { - .disable = sun6i_dsi_encoder_disable, - .enable = sun6i_dsi_encoder_enable, +static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); + int ret; + + if (dsi->panel_bridge) + return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, NULL, 0); + + if (dsi->panel) { + drm_connector_helper_add(&dsi->connector, + &sun6i_dsi_connector_helper_funcs); + ret = drm_connector_init(bridge->dev, &dsi->connector, + &sun6i_dsi_connector_funcs, + DRM_MODE_CONNECTOR_DSI); + if (ret) { + dev_err(dsi->dev, "Couldn't initialise the DSI connector\n"); + goto err_cleanup_connector; + } + + drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); + } + + return 0; + +err_cleanup_connector: + drm_encoder_cleanup(&dsi->encoder); + return ret; +} + +static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { + .enable = sun6i_dsi_bridge_enable, + .disable = sun6i_dsi_bridge_disable, + .attach = sun6i_dsi_bridge_attach, }; static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi, @@ -1063,8 +1094,6 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, struct sun6i_dsi *dsi = dev_get_drvdata(dev); int ret; - drm_encoder_helper_add(&dsi->encoder, - &sun6i_dsi_enc_helper_funcs); ret = drm_simple_encoder_init(drm, &dsi->encoder, DRM_MODE_ENCODER_DSI); if (ret) { @@ -1073,27 +1102,12 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, } dsi->encoder.possible_crtcs = BIT(0); - drm_connector_helper_add(&dsi->connector, - &sun6i_dsi_connector_helper_funcs); - ret = drm_connector_init(drm, &dsi->connector, - &sun6i_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); if (ret) { - dev_err(dsi->dev, - "Couldn't initialise the DSI connector\n"); + dev_err(dsi->dev, "Couldn't attach drm bridge\n"); goto err_cleanup_connector; } - drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - - if (dsi->panel_bridge) { - ret = drm_bridge_attach(&dsi->encoder, dsi->panel_bridge, NULL, 0); - if (ret) { - dev_err(dsi->dev, "Couldn't attach drm bridge\n"); - goto err_cleanup_connector; - } - } - return 0; err_cleanup_connector: @@ -1199,6 +1213,12 @@ static int sun6i_dsi_probe(struct platform_device *pdev) goto err_unprotect_clk; } + dsi->bridge.funcs = &sun6i_dsi_bridge_funcs; + dsi->bridge.of_node = dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; + + drm_bridge_add(&dsi->bridge); + ret = component_add(&pdev->dev, &sun6i_dsi_ops); if (ret) { dev_err(dev, "Couldn't register our component\n"); @@ -1222,6 +1242,7 @@ static int sun6i_dsi_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sun6i_dsi *dsi = dev_get_drvdata(dev); + drm_bridge_remove(&dsi->bridge); component_del(&pdev->dev, &sun6i_dsi_ops); mipi_dsi_host_unregister(&dsi->host); clk_rate_exclusive_put(dsi->mod_clk); diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 370ecb356a63..5e70666089ad 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -16,6 +16,7 @@ #define SUN6I_DSI_TCON_DIV 4 struct sun6i_dsi { + struct drm_bridge bridge; struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; @@ -38,6 +39,11 @@ static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) return container_of(host, struct sun6i_dsi, host); }; +static inline struct sun6i_dsi *bridge_to_sun6i_dsi(struct drm_bridge *bridge) +{ + return container_of(bridge, struct sun6i_dsi, bridge); +} + static inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector) { return container_of(connector, struct sun6i_dsi, connector); From patchwork Sun Feb 14 19:40:59 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087401 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 13263C433E0 for ; Sun, 14 Feb 2021 19:41:38 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 AF1D764DBA for ; Sun, 14 Feb 2021 19:41:37 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org AF1D764DBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 2C38A6E0AC; Sun, 14 Feb 2021 19:41:37 +0000 (UTC) Received: from mail-pl1-x62d.google.com (mail-pl1-x62d.google.com [IPv6:2607:f8b0:4864:20::62d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 9E2846E0AC for ; Sun, 14 Feb 2021 19:41:35 +0000 (UTC) Received: by mail-pl1-x62d.google.com with SMTP id s15so2535749plr.9 for ; Sun, 14 Feb 2021 11:41:35 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=SRxs/aOjY1GsbWu/T3aB0+EANdf6JlXR2K+G27uoYio=; b=lR/8/4IFFoTMpCeL7fiEaAelu4F/iUPDfjwLukR0qPIqJVMN0UQICGWjJdI/ISNDZ0 mwO0IcLS/PQ+cfrs3T+K0QEgmQjPMAacO0StWVDksWF7BGvK+kfP5qYZBPNnWn/45Joj zSfCKXtsvHFxb7rfHwyUBpOYvVvHxXjqv01dY= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=SRxs/aOjY1GsbWu/T3aB0+EANdf6JlXR2K+G27uoYio=; b=L58xZiva8V/0kexDQuaECPS1urJI5OtZvh/364dscI15pqlsVSheVhxNBUbQXljGfu zloldvj5Eyy8bHo/Sa/bAzGciTDBF1+aaYHEC2yAjAOZQcrr8LLnV3UlUvjToDOtDQRI z3BjGnG7P5VOkCKOxt4ojLSyDwLIuARQZ08mGxGNKgmb1tYp7l+O/AWQK7mNj7J9uoHv /9uWRuwf2HXde5j0FUiI+Mwg13Y51tF5sYuShfVTm7H5Kh/IgceWqnCIZSa5l/0w0b/G mUTfQcTNtkBuA0+homf40YCDSQBdZD8f76LBA6z6W7m1iEBC1Nzrs9hqI1byQ2BpOeap xzqw== X-Gm-Message-State: AOAM531QSHYKFyQvdPbwTfKC65QpwEs8lrgjXKnTb28G1qhTZhfXnPxj WiCInNdTU9NYi6m2m4DhwH8LMg== X-Google-Smtp-Source: ABdhPJx7aJtbIv9KAW+oJiidaq/ehl3ZHXkulFd2VYinMmQZVn+HjeAEbrtWl9HLM99JJZ6vYfsw2g== X-Received: by 2002:a17:902:7c83:b029:e2:b157:e25c with SMTP id y3-20020a1709027c83b02900e2b157e25cmr12216978pll.32.1613331695308; Sun, 14 Feb 2021 11:41:35 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:34 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 4/7] drm: sun4i: dsi: Separate code for bridge pre_enable Date: Mon, 15 Feb 2021 01:10:59 +0530 Message-Id: <20210214194102.126146-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The existing driver has an enablement code for initializing clock, reset, PHY, DSI timings, and finally switching to HS mode. Move the clock, reset. PHY and DSI timings code into bridge pre_enable and keep HS mode switch in enable. As the driver supports fully enabled bridge functionalities, this new enablement code separation will help to initialize the host and slave bridge pre_enable, enable functions properly. Signed-off-by: Jagan Teki --- Changes for v3: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 6f3c5330a468..3cdc14daf25c 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -714,7 +714,7 @@ static int sun6i_dsi_start(struct sun6i_dsi *dsi, return 0; } -static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) +static void sun6i_dsi_bridge_pre_enable(struct drm_bridge *bridge) { struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); @@ -775,6 +775,11 @@ static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) if (dsi->panel_bridge) dsi->panel_bridge->funcs->pre_enable(dsi->panel_bridge); +} + +static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) +{ + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); /* * FIXME: This should be moved after the switch to HS mode. @@ -883,6 +888,7 @@ static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, } static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { + .pre_enable = sun6i_dsi_bridge_pre_enable, .enable = sun6i_dsi_bridge_enable, .disable = sun6i_dsi_bridge_disable, .attach = sun6i_dsi_bridge_attach, From patchwork Sun Feb 14 19:41:00 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087403 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 A204FC433E0 for ; Sun, 14 Feb 2021 19:41:41 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 6ED1A64DBA for ; Sun, 14 Feb 2021 19:41:41 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 6ED1A64DBA Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id EFBAE6E0AF; Sun, 14 Feb 2021 19:41:40 +0000 (UTC) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by gabe.freedesktop.org (Postfix) with ESMTPS id 598A36E0AF for ; Sun, 14 Feb 2021 19:41:40 +0000 (UTC) Received: by mail-pj1-x1033.google.com with SMTP id q72so2489612pjq.2 for ; Sun, 14 Feb 2021 11:41:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=uYz3kOtrZ6Hf5DjXT1UkBRogQ4J1lPOvWIWH1kd6QXA=; b=aO2QjQGa2mG9vCy1BwYu3zPMtnftm5Mg2AM9uV8EZImKreIS9VatNBo8bb0qRtNplE 3OBD8aDO1PGAaH8XGG16wdFBOCLqqTx5nMR5pn1I8GBZO4l4CssVedKyRpXL6TVYrtw6 TcovWJ3IIlzD1+m8i7Q6j4uqUZI5AThOLWvR4= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=uYz3kOtrZ6Hf5DjXT1UkBRogQ4J1lPOvWIWH1kd6QXA=; b=TDCWNtqUbziEdEuidfbXBdh305VFau7CwpEPMDjPfuh1dm4v4S4L9v26IGDC1nph6y 3SnaBynIvYWrAKn5GIIDu+aGbcFxOcDwzOjYUYgJsVzGojd9iXYa6s5xMa5JJvTFnD3F /pmYsw8MDpbOovqKHW2/rInJT4BPmN3z6Al2rleKxCgKeOD2Y9NjhGUzvqfD2SBBFDHv FNq3EWIzWXByiP0/KDgm6db7WYHVhVYXHdDNGFYcjuwZYrdmZDqb7eJKxQ6xEJQHtch8 RlK54jH30yQSZ7DkyBLic9GsJe8+YU3zpb6syfb+vGoQ7MA4qlBz2GAJVnRHJn/w/+ks jClw== X-Gm-Message-State: AOAM530MkURf+dXo6rPQ/ZeeCy0ZzCGn0lGRzYOGOwPqbaU4ohfJXz+b fyT9m0wR9qujZPGrfBTlcp5doQ== X-Google-Smtp-Source: ABdhPJzLLpSe6h6YLhCLR1f9osYYHY7qcokxZFU5wgjVcteYh/v71KLAWqCEIpbS89QnvAza0juNXg== X-Received: by 2002:a17:90b:4d06:: with SMTP id mw6mr12223997pjb.24.1613331699994; Sun, 14 Feb 2021 11:41:39 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.35 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:39 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 5/7] drm: bridge: Queue the bridge chain instead of stacking Date: Mon, 15 Feb 2021 01:11:00 +0530 Message-Id: <20210214194102.126146-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: linux-kernel@vger.kernel.org, dri-devel@lists.freedesktop.org, Jagan Teki , Thomas Zimmermann , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" drm_bridge_attach has stacked the bridge chain, so the bridge that gets pushed last can trigger its bridge function pre_enable first from drm_atomic_bridge_chain_pre_enable. This indeed gives a chance to trigger slave bridge pre_enable first without triggering its host bridge pre_enable for the usual host to slave device model like DSI host with panel slave. For fully enabled bridge drivers, host bridge pre_enable has all host related clock, reset, PHY configuration code that needs to initialized before sending commands or configuration from a slave to communicate its host. Queue the bridge chain instead of stacking it so-that the bridges that got enqueued first can have a chance to trigger first. Cc: Maarten Lankhorst Cc: Thomas Zimmermann Signed-off-by: Jagan Teki --- Changes for v3: - new patch drivers/gpu/drm/drm_bridge.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/drm_bridge.c b/drivers/gpu/drm/drm_bridge.c index 64f0effb52ac..e75d1a080c55 100644 --- a/drivers/gpu/drm/drm_bridge.c +++ b/drivers/gpu/drm/drm_bridge.c @@ -191,9 +191,9 @@ int drm_bridge_attach(struct drm_encoder *encoder, struct drm_bridge *bridge, bridge->encoder = encoder; if (previous) - list_add(&bridge->chain_node, &previous->chain_node); + list_add_tail(&bridge->chain_node, &previous->chain_node); else - list_add(&bridge->chain_node, &encoder->bridge_chain); + list_add_tail(&bridge->chain_node, &encoder->bridge_chain); if (bridge->funcs->attach) { ret = bridge->funcs->attach(bridge, flags); From patchwork Sun Feb 14 19:41:01 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087405 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED,USER_AGENT_GIT autolearn=ham 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 A42ADC433E0 for ; Sun, 14 Feb 2021 19:41:46 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 66E4464D8F for ; Sun, 14 Feb 2021 19:41:46 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 66E4464D8F Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id D4C626E0B7; Sun, 14 Feb 2021 19:41:45 +0000 (UTC) Received: from mail-pj1-x1032.google.com (mail-pj1-x1032.google.com [IPv6:2607:f8b0:4864:20::1032]) by gabe.freedesktop.org (Postfix) with ESMTPS id EA4B16E0B7 for ; Sun, 14 Feb 2021 19:41:44 +0000 (UTC) Received: by mail-pj1-x1032.google.com with SMTP id l18so2620781pji.3 for ; Sun, 14 Feb 2021 11:41:44 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Vc5KRcpkrSfSP9D4LPgPMNcSqRtFMop54GG77rWCzXY=; b=Mccj3Wh+PlMfxtLcbH65pM7vuw5oxEhSkUkF1c4iAgwrY8lMBA+q8L8yHw6o3YXkZO YOHirmcbcWec/Os7NUQ2G/cyC21MnhsltrHWeZf9ehv8Es8rKeJqsHdumkFNGvT+EAjV 7QdZIazWfU0UljBjoz6zKdMv9Bjb2/P+oeD0c= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vc5KRcpkrSfSP9D4LPgPMNcSqRtFMop54GG77rWCzXY=; b=ANXpOsf971afbQy3+V6kP96dOGfsF1tR++gIaU8CWfWjiDeEikI3e85dYc/BskLvpT z6dTLHlQx7b74gx0v8VF4WLdKeqNveLHH5/eC4eA5I+ZiXY7X39oA7swjjqNc1adwkm/ u2Qq/71jZWTUdEhGDcASck5x7CqCQxYT3NTL8aAbFGqaFee5yPnrd7XOEij67PtmTBBp zaAe1N3oV3d+ZbXY3LQ8Wme1pcAtKIhISZQADjTff4nE1t+wsAqCJyWM2zX6TI9SoN4F 4XVJ9rJ4WzqsJkcoupKFEdi5vxuy9NvKWxBVxKQWtkBpWcDXDsufQJs3zccantW/evjk zVkQ== X-Gm-Message-State: AOAM530flcQN241+9wv6+x5KUi58gr5pMOsCrjl2EL8qp14sFQp6Z0ow z6v2PR/quzVkcabbuhHmbj04eA== X-Google-Smtp-Source: ABdhPJyOz3Qj5yfB0wNBVt9gfgPrFtOAWwP3Tn8Brw3R+wn/ER5CaxyvhJz9wIhmPdAoC/+eZ7BYGw== X-Received: by 2002:a17:902:860a:b029:e3:5d18:29af with SMTP id f10-20020a170902860ab02900e35d1829afmr188248plo.64.1613331704576; Sun, 14 Feb 2021 11:41:44 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:44 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [PATCH v3 6/7] drm: sun4i: dsi: Use drm_panel_bridge, connector API Date: Mon, 15 Feb 2021 01:11:01 +0530 Message-Id: <20210214194102.126146-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Use drm_panel_bridge to replace manual panel handling code. This simplifies the driver to allows all components in the display pipeline to be treated as bridges, paving the way to generic connector handling. Use drm_bridge_connector_init to create a connector for display 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: Jagan Teki --- Changes for v3: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 108 +++++++------------------ drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 7 -- 2 files changed, 27 insertions(+), 88 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 3cdc14daf25c..5e5d3789b3df 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -20,6 +20,7 @@ #include #include +#include #include #include #include @@ -769,12 +770,6 @@ static void sun6i_dsi_bridge_pre_enable(struct drm_bridge *bridge) phy_set_mode(dsi->dphy, PHY_MODE_MIPI_DPHY); phy_configure(dsi->dphy, &opts); phy_power_on(dsi->dphy); - - if (dsi->panel) - drm_panel_prepare(dsi->panel); - - if (dsi->panel_bridge) - dsi->panel_bridge->funcs->pre_enable(dsi->panel_bridge); } static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) @@ -793,12 +788,6 @@ static void sun6i_dsi_bridge_enable(struct drm_bridge *bridge) * ordering on the panels I've tested it with, so I guess this * will do for now, until that IP is better understood. */ - if (dsi->panel) - drm_panel_enable(dsi->panel); - - if (dsi->panel_bridge) - dsi->panel_bridge->funcs->enable(dsi->panel_bridge); - sun6i_dsi_start(dsi, DSI_START_HSC); udelay(1000); @@ -812,14 +801,6 @@ static void sun6i_dsi_bridge_disable(struct drm_bridge *bridge) DRM_DEBUG_DRIVER("Disabling DSI output\n"); - if (dsi->panel) { - drm_panel_disable(dsi->panel); - drm_panel_unprepare(dsi->panel); - } else if (dsi->panel_bridge) { - dsi->panel_bridge->funcs->disable(dsi->panel_bridge); - dsi->panel_bridge->funcs->post_disable(dsi->panel_bridge); - } - phy_power_off(dsi->dphy); phy_exit(dsi->dphy); @@ -828,63 +809,13 @@ static void sun6i_dsi_bridge_disable(struct drm_bridge *bridge) regulator_disable(dsi->regulator); } -static int sun6i_dsi_get_modes(struct drm_connector *connector) -{ - struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector); - - return drm_panel_get_modes(dsi->panel, connector); -} - -static const struct drm_connector_helper_funcs sun6i_dsi_connector_helper_funcs = { - .get_modes = sun6i_dsi_get_modes, -}; - -static enum drm_connector_status -sun6i_dsi_connector_detect(struct drm_connector *connector, bool force) -{ - struct sun6i_dsi *dsi = connector_to_sun6i_dsi(connector); - - return dsi->panel ? connector_status_connected : - connector_status_disconnected; -} - -static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { - .detect = sun6i_dsi_connector_detect, - .fill_modes = drm_helper_probe_single_connector_modes, - .destroy = drm_connector_cleanup, - .reset = drm_atomic_helper_connector_reset, - .atomic_duplicate_state = drm_atomic_helper_connector_duplicate_state, - .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, -}; - static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); - int ret; - - if (dsi->panel_bridge) - return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, NULL, 0); - - if (dsi->panel) { - drm_connector_helper_add(&dsi->connector, - &sun6i_dsi_connector_helper_funcs); - ret = drm_connector_init(bridge->dev, &dsi->connector, - &sun6i_dsi_connector_funcs, - DRM_MODE_CONNECTOR_DSI); - if (ret) { - dev_err(dsi->dev, "Couldn't initialise the DSI connector\n"); - goto err_cleanup_connector; - } - - drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - } - - return 0; -err_cleanup_connector: - drm_encoder_cleanup(&dsi->encoder); - return ret; + return drm_bridge_attach(bridge->encoder, dsi->panel_bridge, + &dsi->bridge, flags); } static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { @@ -1010,17 +941,24 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, struct mipi_dsi_device *device) { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); + struct drm_panel *panel; int ret; ret = drm_of_find_panel_or_bridge(dsi->dev->of_node, 0, 0, - &dsi->panel, &dsi->panel_bridge); + &panel, &dsi->panel_bridge); if (ret) return ret; + if (panel) { + dsi->panel_bridge = devm_drm_panel_bridge_add(dsi->dev, panel); + if (IS_ERR(dsi->panel_bridge)) + return PTR_ERR(dsi->panel_bridge); + } + dsi->device = device; - dev_info(host->dev, "Attached %s %s\n", - device->name, dsi->panel ? "panel" : "bridge"); + dev_info(host->dev, + "Attached %s %s\n", device->name, panel ? "panel" : "bridge"); return 0; } @@ -1030,7 +968,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - dsi->panel = NULL; dsi->panel_bridge = NULL; dsi->device = NULL; @@ -1098,6 +1035,7 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, { struct drm_device *drm = data; struct sun6i_dsi *dsi = dev_get_drvdata(dev); + struct drm_connector *connector; int ret; ret = drm_simple_encoder_init(drm, &dsi->encoder, @@ -1108,15 +1046,23 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, } dsi->encoder.possible_crtcs = BIT(0); - ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, 0); - if (ret) { - dev_err(dsi->dev, "Couldn't attach drm bridge\n"); - goto err_cleanup_connector; + ret = drm_bridge_attach(&dsi->encoder, &dsi->bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret) + goto err_cleanup_encoder; + + connector = drm_bridge_connector_init(drm, &dsi->encoder); + if (IS_ERR(connector)) { + DRM_ERROR("Unable to create bridge connector\n"); + ret = PTR_ERR(connector); + goto err_cleanup_encoder; } + drm_connector_attach_encoder(connector, &dsi->encoder); + return 0; -err_cleanup_connector: +err_cleanup_encoder: drm_encoder_cleanup(&dsi->encoder); return ret; } diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 5e70666089ad..91ea95326ed4 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -17,7 +17,6 @@ struct sun6i_dsi { struct drm_bridge bridge; - struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; @@ -30,7 +29,6 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; - struct drm_panel *panel; struct drm_bridge *panel_bridge; }; @@ -44,11 +42,6 @@ static inline struct sun6i_dsi *bridge_to_sun6i_dsi(struct drm_bridge *bridge) return container_of(bridge, struct sun6i_dsi, bridge); } -static inline struct sun6i_dsi *connector_to_sun6i_dsi(struct drm_connector *connector) -{ - return container_of(connector, struct sun6i_dsi, connector); -}; - static inline struct sun6i_dsi *encoder_to_sun6i_dsi(const struct drm_encoder *encoder) { return container_of(encoder, struct sun6i_dsi, encoder); From patchwork Sun Feb 14 19:41:02 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12087407 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=-16.6 required=3.0 tests=BAYES_00,DKIM_INVALID, DKIM_SIGNED,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,USER_AGENT_GIT autolearn=ham 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 47EA7C433E0 for ; Sun, 14 Feb 2021 19:41:51 +0000 (UTC) Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (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 0BDB564DD8 for ; Sun, 14 Feb 2021 19:41:51 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0BDB564DD8 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6CD476E0BE; Sun, 14 Feb 2021 19:41:50 +0000 (UTC) Received: from mail-pj1-x1033.google.com (mail-pj1-x1033.google.com [IPv6:2607:f8b0:4864:20::1033]) by gabe.freedesktop.org (Postfix) with ESMTPS id 35A876E0BE for ; Sun, 14 Feb 2021 19:41:49 +0000 (UTC) Received: by mail-pj1-x1033.google.com with SMTP id d2so2618830pjs.4 for ; Sun, 14 Feb 2021 11:41:49 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=PjDic6T8CX1s3JQ+rCi0YZO3YnZwESEKbfpyyMhv06I=; b=IB0GXfTI23zPCdLey3dgL1oxizKborBIIOJn6Y3bG3GnJOXQ6Jw2rapttjw94GXHax 4Qf+zQgtIGQbcpMfsWk7r8TtZl7XQFhqZgytPTnDQshyHGaw9IKLJLap2on299oR1L5o MZMAxnnV87a5W1qDBu7jSmbvEcPikFtYQBiqI= 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:in-reply-to :references:mime-version:content-transfer-encoding; bh=PjDic6T8CX1s3JQ+rCi0YZO3YnZwESEKbfpyyMhv06I=; b=gtoBGSrGTgV6EwDhTSQWTvzCfEb6Fk6eumOdWeQlMicp55QKsXRopnGJN7lNlxEGDn 36Dj/q7a20lKJx1d0qosmleqyvF6DG/sJVGvTzOTjEIm9qCCSTb7F6R6BaJf91MaQlfe tSjNifmcrrqn4/JdvinMiAMpJhaiDSE2pFDLNXiQB1yv1ZUGFHVAy6Z1bjnC4rrFqZmg lj26pGVaOrH7ub2792MAzaPT+/ax/4jmRGDebBQn3DbA5Me1iknT3gZEBy99VtwMwLzu pjn173H87nhGjLw761YR/m4hk9wiPnFFpfv2qAV5Ced7X5GQPrbJLKH7ljRUrouMDpkw GKvw== X-Gm-Message-State: AOAM532AZ7h60KGoDdux6TWSTcghjdG6nFidauwO+hLf6wgKLm3wKC9y 7ltIdqm1mx3duLRwGxZY6DjAHg== X-Google-Smtp-Source: ABdhPJzZ1JR/ha5Z93FWa6lTvn9Kwpxf8X7vB5LWvc9yuHeekMW0I4odGZA8uAVUEIgF4q0vwJ3Z1Q== X-Received: by 2002:a17:90a:d590:: with SMTP id v16mr8459529pju.116.1613331708894; Sun, 14 Feb 2021 11:41:48 -0800 (PST) Received: from ub-XPS-13-9350.domain.name ([45.249.78.214]) by smtp.gmail.com with ESMTPSA id 125sm15129247pfu.7.2021.02.14.11.41.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 14 Feb 2021 11:41:48 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart Subject: [DO NOT MERGE] [PATCH v3 7/7] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 panel Date: Mon, 15 Feb 2021 01:11:02 +0530 Message-Id: <20210214194102.126146-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210214194102.126146-1-jagan@amarulasolutions.com> References: <20210214194102.126146-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Jagan Teki , linux-amarula@amarulasolutions.com, linux-arm-kernel@lists.infradead.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" This patch add support for Bananapi S070WV20-CT16 panel to BPI-M2M board. Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB convertor bridge, so enable bridge along with associated panel. DSI panel connected via board DSI port with, - DCDC1 as VCC-DSI supply - PL5 gpio for bridge reset gpio pin - PB7 gpio for lcd enable gpio pin - PL4 gpio for backlight enable pin Signed-off-by: Jagan Teki --- Changes for v3: - none arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 85 ++++++++++++++++++++ 1 file changed, 85 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts index e1c75f7fa3ca..f3f63187badc 100644 --- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts +++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts @@ -44,6 +44,7 @@ #include "sun8i-a33.dtsi" #include +#include / { model = "BananaPi M2 Magic"; @@ -55,12 +56,21 @@ aliases { i2c2 = &i2c2; serial0 = &uart0; serial1 = &uart1; + mmc0 = &mmc0; }; chosen { stdout-path = "serial0:115200n8"; }; + backlight: backlight { + compatible = "pwm-backlight"; + pwms = <&pwm 0 50000 PWM_POLARITY_INVERTED>; + brightness-levels = <1 2 4 8 16 32 64 128 255>; + default-brightness-level = <8>; + enable-gpios = <&r_pio 0 4 GPIO_ACTIVE_HIGH>; /* LCD-BL-EN: PL4 */ + }; + leds { compatible = "gpio-leds"; @@ -81,6 +91,18 @@ red { }; }; + panel { + compatible = "bananapi,s070wv20-ct16", "simple-panel"; + enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + backlight = <&backlight>; + + port { + panel_out_bridge: endpoint { + remote-endpoint = <&bridge_out_panel>; + }; + }; + }; + reg_vcc5v0: vcc5v0 { compatible = "regulator-fixed"; regulator-name = "vcc5v0"; @@ -122,6 +144,59 @@ &dai { status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + dsi_out: port@0 { + reg = <0>; + + dsi_out_bridge: endpoint { + remote-endpoint = <&bridge_out_dsi>; + }; + }; + }; + + bridge@0 { + compatible = "chipone,icn6211"; + reg = <0>; + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + + ports { + #address-cells = <1>; + #size-cells = <0>; + + bridge_in: port@0 { + reg = <0>; + + bridge_out_dsi: endpoint { + remote-endpoint = <&dsi_out_bridge>; + }; + }; + + bridge_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; +}; + &ehci0 { status = "okay"; }; @@ -157,6 +232,12 @@ &ohci0 { status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +350,10 @@ &sound { status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;