From patchwork Mon Mar 22 14:01:49 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12154843 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=-14.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, 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 82B50C433DB for ; Mon, 22 Mar 2021 14:05:35 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 04B8B6196C for ; Mon, 22 Mar 2021 14:05:34 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 04B8B6196C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=tb8wfRn/cFHF3caOD91/lWa0uytmldUSu4PMl08y+MQ=; b=AOVlCRSE3ItdN1kV0a4lnFIe/ BUdKWcp9l6cLiO8aJxgCNiz816pZ7Ve2HO/ovZ0QbAo3zonhmRfXRBoqSgxHERA6VSWLCOn3gpeg0 F/Rr7omSb+caolAY8CjnjiSUAB2DvDwbFmCvS8Mn8YPqwWL97l+ZDbjj2qK45W0cEZlsjojOjIHdF pylTlNc9rO2y/ZudaWwUgCkGgrzun+e4SyT2HGa5hF/EYXO02suQThDzm4XRMw6YnPqEBex9LgTDl cN+c5uas6V+upIH78fLA79hv4NqQ5Adr/jt1SZ9B2JW7adTZFGtotPzaOxlZgUB/rQ0apH/DBIIpx JUaFVboNQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8a-00Bkhy-UT; Mon, 22 Mar 2021 14:02:33 +0000 Received: from mail-pj1-x1032.google.com ([2607:f8b0:4864:20::1032]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8Q-00Bkgs-0o for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 14:02:24 +0000 Received: by mail-pj1-x1032.google.com with SMTP id x7-20020a17090a2b07b02900c0ea793940so10612968pjc.2 for ; Mon, 22 Mar 2021 07:02:21 -0700 (PDT) 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=yFiw4jYyVPgKKK9i77Vkg4hTSWnNarff0aeFjf5I2bg=; b=FQnXW17jLClsIa0WCco6PtxWqpR+hJ1FFaXzWbR1wwd4gF7f3cF/WbmZhsxFSrKU1+ 7QBqOl6PswpPSu8qPTP5iZoTftcoScwprRC3ZdX1tbFgEC2FBx/lsPVpaEBs2egfV7Zp ZHj/sXaZVDEdjK8MZ6AjnDI9lsrKqWaEVZfXE= 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=yFiw4jYyVPgKKK9i77Vkg4hTSWnNarff0aeFjf5I2bg=; b=K3BbEt+t/74GI+ULZ1Mvc3zPxk6wgq+o7Fv+ChVvHENeoqrs1XWqdoNhyWw5XT5sBP i7op73qk0jE0x0caxglGwDMZPEBG2xEuVUTi12jcJvMOsuGZHyaJIQcIF7abF6zycDun llngAa6eWxEmg95y8yPWKIDCK/xz0MjfYkexrspoSKMuywmG8/wVqYERz1nNdl12p+lF 4LD8rRsaAFAAI6hs8UY/3SvaVe95KgjkJA7SpzocKB7bldXHbKDCGYOUzcWyRXI5yv9+ vg38y0vaZIKjuZOu6HeGliwT0aQjvfA/pO8QPqgUwtPyWNYFpbUs76M+Ksn1NNcNVrcL l6wg== X-Gm-Message-State: AOAM530fn8pUwsN/2p9t6480xGONfu6wVSOYGFLmWmjlto2PU1+FiT5/ PZJdkv+GMphhmpQQjQ0ZGvWH4g== X-Google-Smtp-Source: ABdhPJzE58DFBYBPm4FTbLkJ3y9/1Rr71/9oMKSOYfRiW0F09qVn4uXTqXnLF4g7p2OToVoay3/tiA== X-Received: by 2002:a17:90b:4a4c:: with SMTP id lb12mr13550185pjb.133.1616421740641; Mon, 22 Mar 2021 07:02:20 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:15c1:9a30:414f:d84b]) by smtp.gmail.com with ESMTPSA id gg22sm14112997pjb.20.2021.03.22.07.02.15 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 07:02:20 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart , Samuel Holland Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v4 1/4] drm: sun4i: dsi: Use drm_of_find_panel_or_bridge Date: Mon, 22 Mar 2021 19:31:49 +0530 Message-Id: <20210322140152.101709-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322140152.101709-1-jagan@amarulasolutions.com> References: <20210322140152.101709-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_140222_182561_24FE5345 X-CRM114-Status: GOOD ( 14.95 ) 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 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 Reviewed-by: Laurent Pinchart --- Changes for v4, 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 Mon Mar 22 14:01:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12154845 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=-17.0 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 3BC34C433E0 for ; Mon, 22 Mar 2021 14:05:41 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 D33A96196C for ; Mon, 22 Mar 2021 14:05:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org D33A96196C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=uY23Np9uYxCZfId9tINqxYYMmlfjRLEaGCq2lN9RQ3s=; b=UUZoA2dVbQixzEbJfUVSeDXWa sX6Gx76uXEzj1FsQhpIgiG8URpR9yrSGqQZeOac3FHUVaCsWwmWpkHI4Cvccvg6eEcvJ/39KwjDvY beK+ElaVFjGK4g1B9HBGC2maJeR1FTV1/DPKyQO7vw4MP6gDJY6XXfJckUsHUbwoJTfQxONjgDjdI oLTps31E8ZRZaHJlHLSUqtUgWMQmHNi065WHStr6mokiys+5+TjeW/b2iGvABOyGaydp1xpqIuwpC AaXT2qf+F6cI+6oZVyUm5qi3x1BBMqMMRXxLu9fkPI+8WRnfRDeGQ15KAJhMuwKgUArfTZJYWMCOW ArjnRRQ/A==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8p-00Bkjb-Or; Mon, 22 Mar 2021 14:02:47 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8V-00Bkha-Ou for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 14:02:31 +0000 Received: by mail-pg1-x529.google.com with SMTP id r17so8686686pgi.0 for ; Mon, 22 Mar 2021 07:02:27 -0700 (PDT) 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=tNbrx86DmSZYrQGPtYW/NrYWvp0JiJ6t7g8UyTa2yps=; b=Idm1TRUwyS7zoyZ0x5Jvarukc5YvesuKKpp07dpHvp2f6ETWIWw1+hJgNs8cqOkYVN MTQHCYi83l/IIH2ga0WYbDvz+orKOal6INF2WsCpg1YiA9/HixP5tg2gWFUPQuoqEfwG 14G5gC0WAkIz7nZeQsvBsWWUpzlDe54IsKw40= 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=tNbrx86DmSZYrQGPtYW/NrYWvp0JiJ6t7g8UyTa2yps=; b=lCmACsMf1JiVA6MXAnxEGXIAqg9wYBvhbPyplD83TjKa4UyvTtEG555D/Yb4c1W+BN mRKbNPKcaSM6oDvbrDnAZF+pMAPEhvuBKrVoEAHbwKTg3eklzDbU2vAvVmVhJJ7wP2y/ Cyu115TqhvFvBDGhYC5G+qjPu7uPKjjj1+c1FC+8U8EDPW2DO2fakzFGFXUBtSzRqqi1 aEhNNhot0GpVaJU8S1DjP19x6aHZZ3wd2xYx2Mu2/Eqn6FcefuqQMUjU+Mm1tJd/aCny 2M0cWmTQ7zpp/fBAg99ZtS2Nxf6R4VpX6q4IHSzvIc5HyjjKKwSiJtVAAyeJUuffJnJp zAdA== X-Gm-Message-State: AOAM533llMeaaA9tSjv/gNo2AdkxwF3zVJSZWWRYvKxmTfrcEjceo4Qk 3MaOLE9g1PQwBriE8SepyPLshw== X-Google-Smtp-Source: ABdhPJymBCVrrkdCj22Ow4zPjS5VbcwN1e3vMrGoJ7v1KJtcbO5PMqdgf77gob6DFaR3v/wQx6YRaw== X-Received: by 2002:a63:5044:: with SMTP id q4mr22407823pgl.178.1616421746216; Mon, 22 Mar 2021 07:02:26 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:15c1:9a30:414f:d84b]) by smtp.gmail.com with ESMTPSA id gg22sm14112997pjb.20.2021.03.22.07.02.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 07:02:25 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart , Samuel Holland Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v4 2/4] drm: sun4i: dsi: Add bridge support Date: Mon, 22 Mar 2021 19:31:50 +0530 Message-Id: <20210322140152.101709-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322140152.101709-1-jagan@amarulasolutions.com> References: <20210322140152.101709-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_140227_949051_DF824350 X-CRM114-Status: GOOD ( 21.38 ) 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 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 v4: - none 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 Mon Mar 22 14:01:51 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12154847 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=-17.0 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 38428C433E1 for ; Mon, 22 Mar 2021 14:05:44 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 C028461931 for ; Mon, 22 Mar 2021 14:05:43 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org C028461931 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=QTNIWFP8i8sqPNK1oHi2+qHq31SvHxVZcrLQQkna/xs=; b=kYy6dstWZ8RA1ArRKMLBLqqUV bYTmJ0t+oc+YSUVOLqBvAosYe25ohSSEwp2HeOhW6bQG9ezW/pTnwNEml7BLmjuA7/imQ2izk8+Vf WVsdruPcIqMq/PxoYf08yOUBXKn9pIIyvkHaedbHkzza2FEhpIRJRVDbAvLvmZW67ZcmWh8he7T3i +ajJd4d1Ug1cp2rpZsoyGO2AeLwe0j0TVdAE1AiSCKAzqxF5N/a9jOAq+8FbSPMdJXYHzyQLj3LJ5 rbLPR/LQaOjwoRswl8IMJa1jIH9MZTYAHptjtK3kmlna6pqtkOgwGotGV+sGLXoFURgwzl3VoTgqI cfCueBY1w==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8w-00Bkkg-Vo; Mon, 22 Mar 2021 14:02:55 +0000 Received: from mail-pl1-x631.google.com ([2607:f8b0:4864:20::631]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8a-00Bkhr-ID for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 14:02:34 +0000 Received: by mail-pl1-x631.google.com with SMTP id g1so6627719plg.7 for ; Mon, 22 Mar 2021 07:02:32 -0700 (PDT) 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=ei9A5zbhvayRjVi6Vomvlir4u8ShWE4723QjD9pmyj8=; b=poA302j/mvAkaegxDWYEeeSk17OIGSpov5S1P+W+Nyni670nUYDk56aAlfN0qx378t 6avkS+li79b9qoKIuEJLyjYHYy0peEVG81d9mw6rdaTR7p8VS2HDsWwfwVg0OfTFsCVH BNFDwWBXfQjh8kogqGp4QXi6lwkF95f46UAoU= 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=ei9A5zbhvayRjVi6Vomvlir4u8ShWE4723QjD9pmyj8=; b=FcKAlNd3MvAcg9icqyCYYEyZZrJrL0uSaOZEWM6in0B3HcSPWKl0Au3RiSSsP8XCKr nGhN44jMYVsA5A7YB6nKzRkrVyBDzqgtjlf9sj2ZKs1AzIVVrF8eu24teXkilGrCJiJH sN5qoIoEwQdIdWpyR+Q77dMs4vKFaOA19/A9PJhvozCacYeAGO+ygVRFxkoM0aHLNaH9 4kPQ86WcNkF7ZLcBZCVEvAEcc3zv1z5Q85PYCe8ZddEtW4xBCI1hRtq5cTXgE3GNrUhv OQfgpsxleAXDJSq7OvtBqVuu+wgwG/6RXjC4p9cn8J67edYYO6MAqKkR1LQvgFLQPEQ6 QbFg== X-Gm-Message-State: AOAM5332E08luzg0SQyaTLTCjxClW2irQVKov4UF9PAZAkQB5EUMyfYt fT/MsX8L6vCniJCvf7rCcWl8SQ== X-Google-Smtp-Source: ABdhPJy7CvaUS8zMyaa3jiedTNo+wt6eK9DPbhjlpADTyIB/BG3TdxG1g9aaciqo9pn7TR0iyMRyHg== X-Received: by 2002:a17:90a:f40f:: with SMTP id ch15mr13900475pjb.128.1616421751168; Mon, 22 Mar 2021 07:02:31 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:15c1:9a30:414f:d84b]) by smtp.gmail.com with ESMTPSA id gg22sm14112997pjb.20.2021.03.22.07.02.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 07:02:30 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart , Samuel Holland Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [PATCH v4 3/4] drm: sun4i: dsi: Convert to bridge driver Date: Mon, 22 Mar 2021 19:31:51 +0530 Message-Id: <20210322140152.101709-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322140152.101709-1-jagan@amarulasolutions.com> References: <20210322140152.101709-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_140232_679213_B49D0402 X-CRM114-Status: GOOD ( 19.70 ) 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 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 v4: - none 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 Mon Mar 22 14:01:52 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12154849 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=-17.0 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 D34F3C433E0 for ; Mon, 22 Mar 2021 14:05:48 +0000 (UTC) Received: from desiato.infradead.org (desiato.infradead.org [90.155.92.199]) (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 48C926196C for ; Mon, 22 Mar 2021 14:05:48 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 48C926196C Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=amarulasolutions.com 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=desiato.20200630; h=Sender:Content-Transfer-Encoding :Content-Type:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To:Message-Id:Date: Subject:Cc:To:From:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=gwrXLUMe/BAyBOACapG+GojP5gvn5Cl1vroPxX+gzGU=; b=lE3pOIcl9PaE0lwFXSEFfqgtC H3VHACfMIE9Ul43td1UeMnjchkY1LNlrsqhPdf469SStaFljKd+5lWiIDmKlADJuwVaoAjMPOHqDs UQUosre5x1sxyzgcPtb112TlbIl2ykNbQD270vGy6HPIGkpePS+yIgMFItUX+BzTx4WERA2gPiYlb 8Olx1IldbpjHCujo4gAvsSQ+bpfW7Tek0+p7ADippEOaWpjkKc49wcwJKXiBgO9mZocsDnnwOapEN BHmW3k+HcGVVU+IZYv9WAnIkG8fn/LGeCrY7b9sQXGp/sW4pWraQ8JtKdCQhmr5K/zVqJC5pWZqea 7ZcDoLLpQ==; Received: from localhost ([::1] helo=desiato.infradead.org) by desiato.infradead.org with esmtp (Exim 4.94 #2 (Red Hat Linux)) id 1lOL94-00BkmA-OT; Mon, 22 Mar 2021 14:03:02 +0000 Received: from mail-pg1-x534.google.com ([2607:f8b0:4864:20::534]) by desiato.infradead.org with esmtps (Exim 4.94 #2 (Red Hat Linux)) id 1lOL8f-00BkiU-Qk for linux-arm-kernel@lists.infradead.org; Mon, 22 Mar 2021 14:02:39 +0000 Received: by mail-pg1-x534.google.com with SMTP id k24so8671658pgl.6 for ; Mon, 22 Mar 2021 07:02:37 -0700 (PDT) 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=PyXoPHaQZ1cNX+mAGKi6igLdckQBFbOfNFJ/cXEULis=; b=h854o4L9XSmTnayqqxTV4Aul4fBKdBR+eMB3+813lGBViwceMkC48f43cB3db1QVkc SHELrkl6z4+HCN7TCdHzvc0v4ygzwVHmSR0QvEMnzEVi51uvAWYUMqU1EzqE++umys8k C+ZRTT5XnM3kITbEn4A/ygE6PSl725gFH2UJw= 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=PyXoPHaQZ1cNX+mAGKi6igLdckQBFbOfNFJ/cXEULis=; b=L3Ae2jorNhkNnFyShU5o8F7CzNB9F6KKYQ91Nlwq99FsuIIPukHneYR9wqwPJTsIt1 PAPBrj9hvOvZ42KP3LM2o6cpiJZ+Wj5AT8QZPakY53p+NL38BvcRqkF9EeyXf80l93IV xoUnacPWE9rLfsQoHxP/nBt3CfCGtz6rC2nyRTkMB7TCsdIjEpi54ZZSaB6wQU9q/h/D yC6hxQJ7U3mNNUmtHa0j3RnNjufbQYzQ3G11Klo99Kacqt2CEXNV/3ggmBWpohFuITIH znE8YXqmziWxgXXiEC9bIKfjNOCRoH7Kl48caH8ZYFT1Ok01FKpXMZChSjY5MhcadVbh J4Xg== X-Gm-Message-State: AOAM5320m0U6cCFLXyID9P7OdsGhsDLTcDTiMkssOxkd5GA1swJKYtmU /VYjo5VJ8YCIBOR/mSJSz8Sm2A== X-Google-Smtp-Source: ABdhPJxCHtBytcibfl/HoEBrbHbmElFOCBhhpiiM8IOnXqGhoWB8lC+ZkS2OYUCDViZ1IY++k8ecwQ== X-Received: by 2002:a63:e203:: with SMTP id q3mr23160172pgh.325.1616421756376; Mon, 22 Mar 2021 07:02:36 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a884:15c1:9a30:414f:d84b]) by smtp.gmail.com with ESMTPSA id gg22sm14112997pjb.20.2021.03.22.07.02.31 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 22 Mar 2021 07:02:35 -0700 (PDT) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Jernej Skrabec , Laurent Pinchart , Samuel Holland Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, linux-amarula@amarulasolutions.com, linux-sunxi@googlegroups.com, Jagan Teki Subject: [DO NOT MERGE] [PATCH v4 4/4] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 panel Date: Mon, 22 Mar 2021 19:31:52 +0530 Message-Id: <20210322140152.101709-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210322140152.101709-1-jagan@amarulasolutions.com> References: <20210322140152.101709-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210322_140237_939241_E69A9DBB X-CRM114-Status: GOOD ( 14.64 ) 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 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 converter 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 enable gpio pin - PB7 gpio for lcd enable gpio pin - PL4 gpio for backlight enable pin Signed-off-by: Jagan Teki --- Changes for v4: - replace reset with enable-gpios 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 293016d081cd..6f33e1ae8ffc 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 @@ led-2 { }; }; + panel { + compatible = "bananapi,s070wv20-ct16"; + 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>; + enable-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>;