From patchwork Fri Dec 10 11:17:06 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1801 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9DCE83F365 for ; Fri, 10 Dec 2021 12:17:29 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id s18-20020a63ff52000000b00320f169c0aasf5013992pgk.18 for ; Fri, 10 Dec 2021 03:17:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135048; cv=pass; d=google.com; s=arc-20160816; b=MaXF84hKC81Z1ghBwk+AQb13uS0pPiyA7LHuNlDcStxWuVS7wvRh5TN5l/73tS7ju6 9AcbqaXAE6sLTgSpumO3BSf1wY3fZqIpdMF6DrR1/BKoX5oeQKDnLclmS051Rk97pNbK Wqwo+ZNNshRal10Xnkyz1sJb6UCW5Yc/kRhIdujEQzAcY5i99VksvGq7DaiwT5p59utW O9lAazz7LdM/pwLSEO5cDN3cxk33U+z7SpU8AE3oG3I3MVRBB6WqaiwTHLDzhyN1yeAK X67R8KpTDiCLS/oghvFubv5/J2ZMY6Dw3YDq2M6jQLZ5KcoS6M2Ip8sehULHAPhkufJd akYA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=Lj5rjzk8TJ7ttehi3JLrJ77zHCxN+rclnNVWUIZ1CHIcXR56D/y2g61LyfDENKz/+Q BoumCvlICCiExXmCtPF1t7b+pCsvGhDz6CeDiWgs0dg5oh0EndaZdX1Li6D1UYNU8TU+ d5Pi9u+vZJQvs4MPF3qVzY/Be5gpNW5k0RFGM8bsgGfRXXWVB5RCLzX2WrWnVCDk7mmO qUlPZfy3QbFQgZQM9uT55Xg+blT8viNilhhsyAtJlfBOrjIPY0OA2o/mUoLxD9QNgBKk YKSOY35lwh7sJ4sMzMJFFH3QsIcfVopFiKdJNmevGWP+Rekmbutuy5nmOD9FhWmEK0E5 Kleg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=giU7JbN2FtvxYU7xN8o0O53efXM8m2H2IFtuMM1gHgzPqy6WyAAlBsObQmgn1fOCQC u2MY9048BNjtDja/hMHu981nmJVVCctazAeIp13UH13hebKqT/K3TKDaUhmze/ngoS/T ObZy4KgQdz9r9I76rv/QpTDAHDideWMO8EyE0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=76k1Z8FvIP6MGCn+8Vm1cByRYXzYqKKoFoyExoIMQwE=; b=rHt1zVMY+Ro6xK2DJ8SsPeNoge+O0Y6+j3+yTzJ3OJ9V+Li8BIT0ut4sWLUZNg3+2K DDqPZpsGJbZJyDRenbmaLq1vGxvolqsBLCorNB6FrE2Z6MiNQ8PI4NixrwJZ4TuGLpHv Bjo1acpuGvIyEzbwSTAAX6kOzQzMbEXUTg9GxY37fvVa+E37zMTLu4mDWArRgdsPar3v i9rO3nIfOKP5kk1Q/MIHy6+tv+wIE5G5jVoalrJNjp+rEguPO0js2xh4QUsPGsx/EuWQ S7PsSaibFBMU1MhxjLUK9MYzm7fYE3vVEQrCJVDvTahgspduq2Y4IW9gN/Gi/aTJCbSp /X8g== X-Gm-Message-State: AOAM531EnQTDUT7f1Dw3zIm2OAsmQeKF8KQyeBwn/Wf5HlMVZ0p16DMi Z+yWFwqJ53pA0mbJscz8dszdPtr3 X-Google-Smtp-Source: ABdhPJxkMx6bw5ffPLJ9rBWLqVfFQrcXtrQn2+Ba9GhMwoQr4HfNX5igV1swl6ylarjr3MPvgGjsuA== X-Received: by 2002:a17:902:ba84:b0:142:5514:8dd7 with SMTP id k4-20020a170902ba8400b0014255148dd7mr75337500pls.87.1639135047999; Fri, 10 Dec 2021 03:17:27 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:da8c:: with SMTP id j12ls4808244plx.4.gmail; Fri, 10 Dec 2021 03:17:27 -0800 (PST) X-Received: by 2002:a17:902:9b95:b0:143:b899:5b12 with SMTP id y21-20020a1709029b9500b00143b8995b12mr73778849plp.13.1639135047260; Fri, 10 Dec 2021 03:17:27 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135047; cv=none; d=google.com; s=arc-20160816; b=nv6Z/Kkh8bMBXENVkLKsvBIejiwjkfu+YuhspVitcJb0MYN322tDLJ9h3MjHk5mcYg kIClrX9nnnm2n/d+DOUBS0ZZ4/0m8xM5ZuZsgJIE8LNAnfyICVTqZcY/QlNXSuwFX9Ct FtroWFt8WHthRJmHAuM6YEhP9vTbJOLR7oqikVevV6jjVQ599aKb/hl8ufJZpCag7QNs U/KTJKJX95GvW8hGY/6MDt5oifhJp0iHVbEljZUfGopr1VVXxbXCNHNwGkjxImp0nBSK ZxvLtTASXQ2isGzS7jDZbTg7LmriscYct1fjkqIMW1N67UxBAep5jsEyhU4A03urspC4 gnNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Wv27UtE1e1W7hQoof9oQU8Yg5PSkgE+pRTTj9nNNXMw=; b=j7hMrCIF0avZizqAu1+4E9uHy6Eq458jBp1P5ekCwFIgRSoKrEbUp8W6YPYg9ffzhC P6GRC27nxoCMvn44Qz1ZIsvlzPnvzCWDy2z0MNpR0lC30Eku0Mt8fvU2ukeAjGA0XRBN Ggc7fuGl5nvIMze9d9unmPL81jBpF2FaoCRPtwnuqLOp9LqSr6vXZdTceN7ARxyZ+Jb1 /AvMkxAk+ycuX0SnIjc37Si5puWxzDV6LlShnU/zhwr1qkbMFvmRMDFF3tB2kvT9OQ3v gJ1vwJf8V/EDEF9O6T4InSr576WTBy4eo38cPhC/XeCZu/KEUESaiTLk1Yppu4GiwyP+ 9oHw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id s22sor2079610pfw.72.2021.12.10.03.17.27 for (Google Transport Security); Fri, 10 Dec 2021 03:17:27 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a63:1413:: with SMTP id u19mr39058934pgl.109.1639135047001; Fri, 10 Dec 2021 03:17:27 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:26 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v6 1/6] drm: sun4i: dsi: Drop DRM bind race with bridge attach Date: Fri, 10 Dec 2021 16:47:06 +0530 Message-Id: <20211210111711.2072660-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=DGYyqvxV; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Existing host driver will keep looking for DRM pointer in sun6i_dsi_attach and defers even if the particular DSI device is found for the first time. Meanwhile it triggers the bind callback and gets the DRM pointer and then continues the sun6i_dsi_attach. This makes a deadlock situation if sun6i_dsi_attach is trying to find the bridge. If interface bridge is trying to call host attach, then host sun6i_dsi_attach is trying to find bridge and defers the interface bridge even if it found the bridge as bind callback does not complete at the movement. So, this sun6i_dsi_attach defers interface bridge and triggers the bind callback and tries to attach the bridge with a bridge pointer which is not available at the moment. Eventually these callbacks are triggered recursively, as sun6i_dsi_attach defers interface bridge and bind callback defers sun6i_dsi_attach due to invalid bridge ponter. This patch prevents this situation by probing all DSI devices on the pipeline first and then triggers the bind callback by dropping exing DRM binding logic. Signed-off-by: Jagan Teki --- Changes for v6: - none Changes for v5: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 10 +--------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 - 2 files changed, 1 insertion(+), 10 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 527c7b2474da..4bdcce8f1d84 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -967,14 +967,10 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, if (IS_ERR(panel)) return PTR_ERR(panel); - 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); return 0; @@ -988,8 +984,6 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, dsi->panel = NULL; dsi->device = NULL; - drm_kms_helper_hotplug_event(dsi->drm); - return 0; } @@ -1077,8 +1071,6 @@ static int sun6i_dsi_bind(struct device *dev, struct device *master, drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); - dsi->drm = drm; - return 0; err_cleanup_connector: @@ -1091,7 +1083,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..61e88ea6044d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -29,7 +29,6 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; - struct drm_device *drm; struct drm_panel *panel; }; From patchwork Fri Dec 10 11:17:07 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1802 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8E5B03F15A for ; Fri, 10 Dec 2021 12:17:40 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id x14-20020a627c0e000000b0049473df362dsf5470690pfc.12 for ; Fri, 10 Dec 2021 03:17:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135057; cv=pass; d=google.com; s=arc-20160816; b=vjpK/cCmITgBEan8vcC0M5pdGqYKixLcoBq5a+Ba+Vibe7rPi1c+xF6/pLXJJHKBe7 PeqTxig6sR1aiF6LFgF/cNa6alM8g1IF5hjoycU9eLLqcPntNTOxumsPN1QHuJvK1syM OPiguvMbgAQX1pAUDyeU70cH8trwI5KOIGPgxkybrUDIkk0rWPBCfJWV/avYtY/z1eK7 tyECnJQHWCU32285Fy0O6QA30MmEaXymbVGrvSukZOWNTEPLAxeJFCcG9R16nPwJm9Hl fku+bW8b3lxxgkEoMrxz89Z98XLbIwdb7sFuZjksunnBXni2bWIeZQSXgszN2Htt0Y0N KFsg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=LG+h4KBtehl8P2aSUtHn4WoDezt7Q4lXIek/izZO10k=; b=gVpwKFrskKxsiwiRczdDKoUYZJa/+GwBGNNNqd4HiQ/RnMY1+BmJaQSym9i6ByDbvV XbpWyIi9og+Q9gKbq7gL9W4uoVkH3baAAmzsml3x9HNdKpPE0MwH9lKMiyb8OLhcil/t MzePW9jASf4afA6EhD8ytuOvv5iHSAnYVpxoy22N5paK3lEB12REiaCKJ04um0QWMJbJ hvF8+jGJPD/l17FnvA4/vAs/1d4yH5/MnMsZpqddloYvxArVcY46eImGElOKi1InZWLQ 21h6GEIC2LMmcoZUTnsmsfXZC0GvNGjUblAwbGXigGPVBLyWnL/oDZxD3kb0l0JL7gfz p/EA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hc5MSWMS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=LG+h4KBtehl8P2aSUtHn4WoDezt7Q4lXIek/izZO10k=; b=DKHO8kHJlFcOvAXnqPjjnUG5vDZZOnMkSujY0udZbKUN6tUE6o9CHWlpkyeS4LfhDp kI6sbp2xjoYOGhZD/+4sXgcxCLjxwGMuQcffLp/98OCes26CCmj9VrRyp3EiHfFPQAYR yXzRMXhKPjzZrFVhX6Q2EPJMLL2z2h8NYdnuk= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=LG+h4KBtehl8P2aSUtHn4WoDezt7Q4lXIek/izZO10k=; b=FXoKzhca6rMgc+A2XF/xjwPxGgHy0UM8L5mzPIu8dPNHt4NzbajZXshMBbUYU5LKvG R3Gvp3L4MYepz1O8eU9KbqL6qWmqoofhmovlgsNXPJustbn3qaVISZrEBpZoMRsoX2/E 3HypOUIlC5KMgnitYfw0mEzKkaO07cuuLfjfdrjHxTLB9ctyVn/xeLDvAtOQwo5gR3Li K51oF3nRBm3bj5s1XzYMaki8WYai6Z2g9eP4MIxCeRlPzEAzfiByfVTsc42sbC+1dIr0 ikkIuengGB64x9+fJ1VYXR28llC8hgkkfk9n0FeVJ4sCeVmO5ek0iYdurUCwKyHwkNI1 X+/A== X-Gm-Message-State: AOAM533oZ2tt/LW++mYdFREO5SfJU6ybbYQq5PT73BXxsDqYbap3UWSd CAJaPqdRoifsCxWk199Gz+zgGqYC X-Google-Smtp-Source: ABdhPJzp35IuL14y8Q2v7MM1QFXIwKWVnIPa28bak/9FV4Kj3kB/5zWmkH6/eUQgG9yT31TE9chMpA== X-Received: by 2002:aa7:8105:0:b0:4a0:2f7c:81b with SMTP id b5-20020aa78105000000b004a02f7c081bmr17297601pfi.25.1639135056870; Fri, 10 Dec 2021 03:17:36 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f687:: with SMTP id l7ls4798331plg.10.gmail; Fri, 10 Dec 2021 03:17:36 -0800 (PST) X-Received: by 2002:a17:90a:bb03:: with SMTP id u3mr23256806pjr.85.1639135056048; Fri, 10 Dec 2021 03:17:36 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135056; cv=none; d=google.com; s=arc-20160816; b=dvYKBW8VeShdNGEEpecfUjQ+WBysc3xztTxsBcg8Jz3srkyHXueQ2K/IjMFd9n/faB 6bSuuiGTavEaMjOEXbgfuJvxgnAth7F1zdHswgfTMRHG5GY5D/pR402zO+ldyM2m1A0D PZ0wAU1Zfs71JwSotRDS+ajqIqFzm3DVVEhQU+BXO3Nn3Zc78ydX2A5bCwY0R9l0thS5 AxeDhLaWvhXjBBMDyVytejopJQ+peDD4EMCna/H78ZnI03VX8CfSDlv8BfOGBohl+9cH JXhW87ubOx85dyOFBEMYmpthmgQEC41lyEkWV1IvFMyZVlC6ec/u7Y+NeE3KrBqmtoMd 4c1A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=TqiplFeVk+BY4Qw9hiZLgYutFh3HymB4iR0Knju+k4M=; b=OFQ2MInzZLtgD3GQk1bS9X3qffS9Nlt5Lga0VGkZWNkBjoI7XnS9KaNJGLfHNFHwU0 x+LVPmRnEFIcm8gun/z8Kv5+dKc30/RDeDGWzlGGcmOLTO/1hjdUbqLCpWO466LFkoIx 20TcF5/uhS1PgDdONrk4rUlzASd45afzzB03x7JLndmHXftxZaXjLNwm1nXpKEcFB1Mp px3vtSPIu88S/1ekoxdKg2qmjTMZFyUxJEcZy+1V3PKzPf6B00r6X3GCcVbVYfNyW7g5 GFuI7BCqJgG8VbObdKawF6iQ34+/XfGHNalVMGuR3wsWXg31FkaLsvpkK3RPE7Ng3UCK C9gw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hc5MSWMS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id lp10sor2327623pjb.21.2021.12.10.03.17.36 for (Google Transport Security); Fri, 10 Dec 2021 03:17:36 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:4ace:: with SMTP id mh14mr23232501pjb.164.1639135055791; Fri, 10 Dec 2021 03:17:35 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:35 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v6 2/6] drm: sun4i: dsi: Add component only once DSI device attached Date: Fri, 10 Dec 2021 16:47:07 +0530 Message-Id: <20211210111711.2072660-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=hc5MSWMS; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Having component_add for running all drm bind callbacks returns error or unbound due to chain of DSI devices connected across bridge topology on a display pipeline. In a typical bridge oriented display pipeline where the host is connected to the bridge converter and that indeed connected to a panel. DRM => SUN6I DSI Host => Chipone ICN6211 => BananaPi Panel The bridge converter is looking for a panel to probe first and then attach the host. The host attach is looking for a bridge converter to probe and preserve bridge pointer, at this movement the host is trying to bind the all callbacks and one of the bind callback in the DSI host is trying to find the bridge using the bridge pointer in sun6i_dsi_attach call. chipone_probe().start drm_of_find_panel_or_bridge mipi_dsi_attach sun6i_dsi_attach drm_of_find_panel_or_bridge chipone_probe().done sun6i_dsi_probe().start mipi_dsi_host_register component_add sun6i_dsi_probe().done However, the movement when panel defers the probe, will make the bridge converter defer the host attach call which eventually found a NULL bridge pointer during DSI component bind callback. So, in order to prevent this scenario of binding invalid bridge, wait for DSI devices on the pipeline to probe first and start the binding process by moving component_add in host probe to attach call. chipone_probe().start drm_of_find_panel_or_bridge mipi_dsi_attach sun6i_dsi_attach drm_of_find_panel_or_bridge component_add chipone_probe().done sun6i_dsi_probe().start mipi_dsi_host_register sun6i_dsi_probe().done Signed-off-by: Jagan Teki --- Changes for v6: - none Changes for v5: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 120 +++++++++++++------------ 1 file changed, 61 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 4bdcce8f1d84..9cf91dcac3f2 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -959,11 +959,63 @@ static int sun6i_dsi_dcs_read(struct sun6i_dsi *dsi, return 1; } +static int sun6i_dsi_bind(struct device *dev, struct device *master, + void *data) +{ + struct drm_device *drm = data; + 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) { + dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n"); + return ret; + } + 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); + 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 void sun6i_dsi_unbind(struct device *dev, struct device *master, + void *data) +{ + struct sun6i_dsi *dsi = dev_get_drvdata(dev); + + drm_encoder_cleanup(&dsi->encoder); +} + +static const struct component_ops sun6i_dsi_ops = { + .bind = sun6i_dsi_bind, + .unbind = sun6i_dsi_unbind, +}; + 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 device *dev = dsi->dev; + int ret; if (IS_ERR(panel)) return PTR_ERR(panel); @@ -973,6 +1025,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, dev_info(host->dev, "Attached device %s\n", device->name); + ret = component_add(dev, &sun6i_dsi_ops); + if (ret) { + dev_err(dev, "Couldn't register our component\n"); + mipi_dsi_host_unregister(&dsi->host); + return ret; + } + return 0; } @@ -984,6 +1043,8 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, dsi->panel = NULL; dsi->device = NULL; + component_del(dsi->dev, &sun6i_dsi_ops); + return 0; } @@ -1041,56 +1102,6 @@ static const struct regmap_config sun6i_dsi_regmap_config = { .name = "mipi-dsi", }; -static int sun6i_dsi_bind(struct device *dev, struct device *master, - void *data) -{ - struct drm_device *drm = data; - 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) { - dev_err(dsi->dev, "Couldn't initialise the DSI encoder\n"); - return ret; - } - 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); - 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 void sun6i_dsi_unbind(struct device *dev, struct device *master, - void *data) -{ - struct sun6i_dsi *dsi = dev_get_drvdata(dev); - - drm_encoder_cleanup(&dsi->encoder); -} - -static const struct component_ops sun6i_dsi_ops = { - .bind = sun6i_dsi_bind, - .unbind = sun6i_dsi_unbind, -}; - static int sun6i_dsi_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1172,16 +1183,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev) goto err_unprotect_clk; } - ret = component_add(&pdev->dev, &sun6i_dsi_ops); - if (ret) { - dev_err(dev, "Couldn't register our component\n"); - goto err_remove_dsi_host; - } - return 0; -err_remove_dsi_host: - mipi_dsi_host_unregister(&dsi->host); err_unprotect_clk: clk_rate_exclusive_put(dsi->mod_clk); err_attach_clk: @@ -1195,7 +1198,6 @@ static int sun6i_dsi_remove(struct platform_device *pdev) struct device *dev = &pdev->dev; struct sun6i_dsi *dsi = dev_get_drvdata(dev); - component_del(&pdev->dev, &sun6i_dsi_ops); mipi_dsi_host_unregister(&dsi->host); clk_rate_exclusive_put(dsi->mod_clk); From patchwork Fri Dec 10 11:17:08 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1803 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 8C2083F15A for ; Fri, 10 Dec 2021 12:17:42 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id i15-20020a63e90f000000b0033a835b882csf104890pgh.13 for ; Fri, 10 Dec 2021 03:17:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135061; cv=pass; d=google.com; s=arc-20160816; b=R6uuc5e4IaOnwJOMvTrE7h/3NJM254dBPsU0bDsa7tsOO831wpmXbxxSBogkleW9Bh YG2n2oyG+rLYvsmuHiHcQN8iFCKS6rOetOJPnajQPeC82PuJmZLoahiiwOkvlNnCXjrZ +v0Ecd+uQoA+bePinzPuAwMwy8q7g0tz8ivg1K8igHzvNhhJKzRqZxXT6WnxEVWIbSO2 axF0SgAFd1SiirXwoo0WMkOWh4BMoKOxN2bNwKRGBaDSQrI3rZ4c2O4qzpuZ2X401RiH KmGKkD911/ljupdy/fYgxL1v7Cxf8QY/2NEYTFilMprNiOLNwAyjTDFsMpfrnC/lGBGS ITDQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=bbRBAwKJfP6L6vFW6x+k1N86Sjs3mZ891ax6ADL+gy4=; b=E9gfnf3jlmO8hsi9zYj/9WC0JY98PQ+l4Lk/UxBjQtJVATp/qJ6vx03LH/dkTp6ftB oqO6TRJIP/qrtCl+cXDwG9vwBai6TYyhlbn8ViQw9Q/IMWwHYDQzXErPQ3gh9fW9Z/Kz +Q8BRUIOb8gOM2kulwTnTsidpkQ349+FJmTk1AWLT7LBl6UIlc1OhlfeCV07JTG6Y/jt sSNZygHp3x8hqIGFVqsT7tuRQN9b4Ap1WCAuhoVZb6nopiA3kvOYW2HIJPM/6OqPWAJ1 8ttZpAceBaULp6LSgGiDNEjG5sS5xgScef9yATj0t5fmjfWaxlTDYuUcG4D3Lb8SYdLj f/3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o9ENum0+; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=bbRBAwKJfP6L6vFW6x+k1N86Sjs3mZ891ax6ADL+gy4=; b=MFB3nOXF+mBN4hbTnRw6BVY89bqp2dB0fGtShP5+igPHkc20FPN9ks95UeII+KxY5o EKJKbniBk40b06zhkKL/1wmVhp/b2oteFCqO5u8S8/w0AhQHX2wX6XhEzlLbQjQO71mJ 8ldtzvI0xZVdj/flIFGLoS5j63O6+55K5+TL0= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=bbRBAwKJfP6L6vFW6x+k1N86Sjs3mZ891ax6ADL+gy4=; b=75shaaMqyMZtadiJmInxxIyvhakaYEYuw9T+SC4droA0UBZBZ50faLtx2Z+vpEHxZU Hu/P34CAvF5xwWJR1SRDJrbKr4iB+dZklMzwqeVWVpYkRry623ZbyuWgJCK4/OU55H8n TthAipxfHsQuxzp+FbWoCBH+sNqp8Lkj/Yaouk1bzl/ApjJMPfFncmNBonhrtTKO3dGW kXMwh2vKgPItcForq8TDGEO/yOMS4mxTrsXRMCW304bJJtqfbDQaFzXcQExUxY6Se9Bq aownxSxjvbJJbyROWkTbvmR2ov5KDa1yNEqpebet5jQBRsV18LIUkAmrOEQIneupzUR6 sNOA== X-Gm-Message-State: AOAM531/udpzh/bXfmmxLUChIVFxT6OvuaSXS23MSd+TRYt3y77cU6xg iOaWjVST18a/Kq5f6xNdLay2g7lU X-Google-Smtp-Source: ABdhPJyK5/+wEW58ob7f3zaN35HP1kabPblhTjRxGR40bq3mB/ypRVGwRxmkLeMYz2TdlEBFhpBa/g== X-Received: by 2002:a63:3c6:: with SMTP id 189mr32953848pgd.406.1639135061411; Fri, 10 Dec 2021 03:17:41 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a81:: with SMTP id b1ls3304403pfl.3.gmail; Fri, 10 Dec 2021 03:17:40 -0800 (PST) X-Received: by 2002:a63:124a:: with SMTP id 10mr4650533pgs.154.1639135060647; Fri, 10 Dec 2021 03:17:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135060; cv=none; d=google.com; s=arc-20160816; b=s7uyXlIMolseaGU0c2j9ibzzNXEwoR1WZ7FJHqJM/G7Hz7TWMXXb8jlQn4lcGMJE1f VXwsVJs7NCQh7VZP8KKXGquAy1LmEl7S7o1hQ+C3k1gFi0n1L7euql1RUtmpjSaY3e2s AzkA15fvUmyk8xaWL1dOTUMPcAH86yQS8MFqtT0rsUC4lT68mQPP+FBFCJmc/9k8C4BL 1moB0kod4J+Oj+I21y77TVTNzZCaqZM7nP7cTu6DDgMT2dmeBhXTnBRPm+kkI/nH+zTY ESWwxOT2fcCjP4AAJ6/5a0jyTd4CcpL+35ucku/uEn054I1HF/zTI05dZ4Oal3hpKoTT VUVw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=1kZgbgJmrlxw0BX7jCIeMycv2sDZ8RydaNArchhpYlI=; b=SIlDbGXjcXYKji0SK5zILnf8j8aKyGNqF2zirrbD1ACA7CkOmQdLizLN3M3orr2iNS DJ9iAMYPwn5t/3ulwsKXkuVx+qo3cEqwHGWIh2vIdzJoEXGHAusy0VKl0YqGrcUgaoVn p/UAxdGPcYccWFBkIPOUNavF4XH+YZgnlbGtoUC22/Ib0df186jB4w20oJMD+9lwvYeh 1D+Lbm+1ynBkgJGPxIIXr8IbdvSS/4sr7orn1VtVp/Et5/+DpnTo6KukyMKUaewEWLZm sOITf/ZydRUrPbgZRs03p5vA00UZcrswFAN303X+ZbMJ1lVDxRXS68iLGlvQBu4+eTig fY3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o9ENum0+; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id h7sor2343860pjj.14.2021.12.10.03.17.40 for (Google Transport Security); Fri, 10 Dec 2021 03:17:40 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90a:ab17:: with SMTP id m23mr22947589pjq.194.1639135060298; Fri, 10 Dec 2021 03:17:40 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:39 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v6 3/6] drm: sun4i: dsi: Add bridge support Date: Fri, 10 Dec 2021 16:47:08 +0530 Message-Id: <20211210111711.2072660-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o9ENum0+; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Some display panels would come up with a non-DSI output, those can have an option to connect the DSI host by means of interface bridge converter. This DSI to non-DSI interface bridge converter would require DSI Host to handle drm bridge functionalities in order to communicate interface bridge. This patch adds support for bridge functionalities in Allwinner DSI controller. Supporting down-stream bridge makes few changes in the driver. - It drops drm_connector and related operations as drm_bridge_attach creates connector during attachment. - It drop panel pointer and iterate the bridge, so-that it can operate the normal bridge and panel_bridge in constitutive callbacks. - It uses devm_drm_of_get_bridge for panel or bridge lookup. It uses port 0 and endpoint 0 to support I2C-based bridges eventhough the usual Allwinner DSI OF graph doesn't require this for panel and non-I2C based downstream bridges. Signed-off-by: Jagan Teki --- Changes for v6: - support donwstream bridge - drop bridge conversion - devm_drm_of_get_bridge() require child lookup https://patchwork.kernel.org/project/dri-devel/cover/20211207054747.461029-1-jagan@amarulasolutions.com/ Changes for v5: - add atomic APIs - find host and device variant DSI devices. Changes for v4, v3: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 83 ++++++++++---------------- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 9 +-- 2 files changed, 33 insertions(+), 59 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 9cf91dcac3f2..f1d612bf1a0b 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 @@ -720,6 +721,7 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; + struct drm_bridge *iter; u16 delay; int err; @@ -769,8 +771,10 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) phy_configure(dsi->dphy, &opts); phy_power_on(dsi->dphy); - if (dsi->panel) - drm_panel_prepare(dsi->panel); + list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { + if (iter->funcs->pre_enable) + iter->funcs->pre_enable(iter); + } /* * FIXME: This should be moved after the switch to HS mode. @@ -784,8 +788,10 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) * 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); + list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { + if (iter->funcs->enable) + iter->funcs->enable(iter); + } sun6i_dsi_start(dsi, DSI_START_HSC); @@ -797,12 +803,16 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) { struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct drm_bridge *iter; DRM_DEBUG_DRIVER("Disabling DSI output\n"); - if (dsi->panel) { - drm_panel_disable(dsi->panel); - drm_panel_unprepare(dsi->panel); + list_for_each_entry(iter, &dsi->bridge_chain, chain_node) { + if (iter->funcs->disable) + iter->funcs->disable(iter); + + if (iter->funcs->post_disable) + iter->funcs->post_disable(iter); } phy_power_off(dsi->dphy); @@ -813,35 +823,6 @@ static void sun6i_dsi_encoder_disable(struct drm_encoder *encoder) 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 const struct drm_encoder_helper_funcs sun6i_dsi_enc_helper_funcs = { .disable = sun6i_dsi_encoder_disable, .enable = sun6i_dsi_encoder_enable, @@ -976,22 +957,17 @@ 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->next_bridge, NULL, 0); if (ret) { - dev_err(dsi->dev, - "Couldn't initialise the DSI connector\n"); - goto err_cleanup_connector; + dev_err(dsi->dev, "Couldn't attach drm bridge\n"); + goto err_cleanup_encoder; } - drm_connector_attach_encoder(&dsi->connector, &dsi->encoder); + list_splice_init(&dsi->encoder.bridge_chain, &dsi->bridge_chain); return 0; -err_cleanup_connector: +err_cleanup_encoder: drm_encoder_cleanup(&dsi->encoder); return ret; } @@ -1013,17 +989,18 @@ 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 device *dev = dsi->dev; int ret; - if (IS_ERR(panel)) - return PTR_ERR(panel); + dsi->next_bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); + if (IS_ERR(dsi->next_bridge)) { + dev_err(dsi->dev, "Couldn't find the bridge\n"); + return PTR_ERR(dsi->next_bridge); + } - dsi->panel = panel; dsi->device = device; - dev_info(host->dev, "Attached device %s\n", device->name); + dev_info(host->dev, "Attached %s\n", device->name); ret = component_add(dev, &sun6i_dsi_ops); if (ret) { @@ -1040,7 +1017,7 @@ static int sun6i_dsi_detach(struct mipi_dsi_host *host, { struct sun6i_dsi *dsi = host_to_sun6i_dsi(host); - dsi->panel = NULL; + dsi->next_bridge = NULL; dsi->device = NULL; component_del(dsi->dev, &sun6i_dsi_ops); @@ -1118,6 +1095,8 @@ static int sun6i_dsi_probe(struct platform_device *pdev) dsi->host.ops = &sun6i_dsi_host_ops; dsi->host.dev = dev; + INIT_LIST_HEAD(&dsi->bridge_chain); + if (of_device_is_compatible(dev->of_node, "allwinner,sun6i-a31-mipi-dsi")) bus_clk_name = "bus"; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 61e88ea6044d..96a219b9c275 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -16,7 +16,6 @@ #define SUN6I_DSI_TCON_DIV 4 struct sun6i_dsi { - struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; @@ -29,7 +28,8 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; - struct drm_panel *panel; + struct drm_bridge *next_bridge; + struct list_head bridge_chain; }; static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) @@ -37,11 +37,6 @@ 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 *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 Fri Dec 10 11:17:09 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1804 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 86C853F15A for ; Fri, 10 Dec 2021 12:17:46 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id w5-20020a634745000000b0030a5bee70e8sf5026792pgk.15 for ; Fri, 10 Dec 2021 03:17:46 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135065; cv=pass; d=google.com; s=arc-20160816; b=aAMSs4uw9rwhC8eeGsQXc0+Cdl23JQ+1uMSY5xRu8rNJupD2ed28s5kR4XcNtwNVr4 ATsxOyqFyBxUl1r7zSbzEEU0IbmPt+0imRoCojF/0Gwg1v6A14upoYBNQXF/gk74yM3B NwMBnG/eDzz6qObR04h5XfLclKn0fIbY5Jati2Ssv8h+D38cmlMmLJAqDkxdzZk2e5oq XuoFUFkBITa7+V3FF3bVuyIP74hplzw+RiMuTAYEBa2mipVL+0hnfSUQDl3zlIABrkZA u0sNQn1uDGeSHawAIovhNRNDNNkH309Jp49P2CKzwKOvCNgT/lT27KdrzWGhNVqh5mgI +Zyg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=gEFQ2XeNSelezNRbt7CpEae7iwJFqx7bLVYi/z8LHxc=; b=eIiZOnbXbddYMSSqs6lx+CNHow2S+fbE7ZeVcajFe22w2wkedzhSbbADp/xzURDCcm 0QRSzNgVAFaZBjXXqSCKQt67R8TQjBIVeoM+U8IRLja3vw4n4xVCiOzu6J52e3lZ55fu pxJOBNe2MZvCqE+59j9mDaIGdQxn/TjG/i23fnEDniefdh94BFr54rLnMC2130PLwoB/ BD6gezHYfcLqLj8DsBjfKp3OBwjPWbFLAQHZRPDld0RyNFjpcTBV7ANpwrOU9aR1DDz7 u2uAiI8FQzr3btC+w63GsA90sNcEvth1Vr5p10Xo3kL4Q+qXWrMhZ/+trY89tfNEZfwt vLmw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RqnPQEYa; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=gEFQ2XeNSelezNRbt7CpEae7iwJFqx7bLVYi/z8LHxc=; b=PqIbNxxb4dfgyg0wL9GyhwiyXxC7XFP1uwYHU3Mj4qtWGCmckStT2FZVeTSdCsTR9D KvGtb45eRiIymnNixq706/tzLm5Tvh9uLXymuGnLBbla7PrX0S7p1Pl+AVjF+VxeTBjR 7Ph7ZUmFiTMZ3KYddMWLeU2/Oe9DD1B+W1TdI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=gEFQ2XeNSelezNRbt7CpEae7iwJFqx7bLVYi/z8LHxc=; b=BVIryee4Uw/vmynQs9ZCoI+QsqCXvXAl92ctrnbtMWQHCqb5hwj7J4t4rOxR8YRdaN ZgHxhRcvv+yucpM6sr+bmBO6NDNoEsRIjGiRHGRx2hGUGMx7Y6j2XoafPaOE6jRfP0z9 Zb+LlztEICvD7Jic8mgmE95ogLg6NoFMmjDp32uWU3x/jVpbr4pRr3LkS5BMhsdrJTFf EVZYnqfqJu7b+ZA1QX/3yGDh4n1xMEYRnP3M8Io7zeP35EdF4II0kymQ09smpvarUXNj RoLzFSEWer2HCqMTXkZIzPK6j29mq1Rld6d+Fm4X9ykds3FZ0rEzjrDJjxspXj76bQm+ yL8Q== X-Gm-Message-State: AOAM533UmbiBh4qA19Ai824CTGYkWE+VedV5tUZDIMG0FIVrLM+0I7Tq v0hOJolDbmySUVmfP/dnXv0bHwET X-Google-Smtp-Source: ABdhPJyAe+TPe0J5swCGymD7aTvITwh/asc9HKO2rAVhFKVQaG2g/6PCxBTJZoUw630vFWtgqc9gSQ== X-Received: by 2002:a17:90b:110a:: with SMTP id gi10mr23177415pjb.124.1639135065402; Fri, 10 Dec 2021 03:17:45 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:f687:: with SMTP id l7ls4798480plg.10.gmail; Fri, 10 Dec 2021 03:17:45 -0800 (PST) X-Received: by 2002:a17:902:904b:b0:143:73ff:eb7d with SMTP id w11-20020a170902904b00b0014373ffeb7dmr73022252plz.85.1639135064768; Fri, 10 Dec 2021 03:17:44 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135064; cv=none; d=google.com; s=arc-20160816; b=SQoylPlzre7aRVpoVr1O68qd3kP2Xp8xbwvLFo8c43hjeugyFiQL40foWTtNO3B4f6 hPkQwtps7G8o99kW0JxBWfNR3fgMPsVkiGqU7BIaELX5w5V5lBj6SSwwC1AmuhPsDJ0I 0MWl6qzwcamq+9JO7jlYtK+n/qCS53IrbaObOgPPS3SxR3VAoirrWp2u/Rz49Otw1rC2 XVH3h79ZCFs7gfKc2MWLsl2ZGKT2EXu4PfJ5sBEVyOlpI+M0gODS+Xl22T8YGhDavOwK OPWuncwpni3sGA/IIWSMeb+Ycw9VjzFLWlh17G4YD1wpcsPpJf6JudgBwKUMeyuvEKS3 iwpg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=0NNSlBkMytmlUqdX2xwQU1vlLDJZ1w1h/BzLFbdr4yY=; b=X0BaZLV3ETGSlcnluTrRPV95s2aCBqvrv3jSp1+v6zYH9p5pqiP3+tjXTf7LyKRrXY 0QPw7XIGbMvE61j0xKk45k047lEi1s5Ugy7br/hDfu2NxT+AGcFNRUad/U0YbXVWQofF 0rSZ2zNrqwLWqHwa+V8v2et6qGl2NsNyhNwqlLtYQuJRdaEvhc92KMbUxQurNGGwe6rN DqrJ55I6bkuVTzWl/YulNshpm5wq0g/fW7L8xBmTGgWTnh8oAPWInQ4bUrevT2UwMuhY DETqHLpdwICQmxpuVWtGJbHVHxOL31aApGG9FpCH55UjJXowjvSxShLGHIHe8ru+epwg fNNA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RqnPQEYa; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id z5sor2297832plk.53.2021.12.10.03.17.44 for (Google Transport Security); Fri, 10 Dec 2021 03:17:44 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:902:f092:b0:141:ccb6:897 with SMTP id p18-20020a170902f09200b00141ccb60897mr75163980pla.89.1639135064477; Fri, 10 Dec 2021 03:17:44 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.40 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:44 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [DO NOT MERGE] [PATCH v6 4/6] ARM: dts: sun8i: bananapi-m2m: Enable iS070WV20-CT16 DSI Panel Date: Fri, 10 Dec 2021 16:47:09 +0530 Message-Id: <20211210111711.2072660-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=RqnPQEYa; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB convertor bridge. Enable support for it. Signed-off-by: Jagan Teki --- .../boot/dts/sun8i-r16-bananapi-m2m-panel.dts | 41 +++++++++++++++++++ 1 file changed, 41 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts index bf5b5e2f6168..04392358b492 100644 --- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.dts +++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-panel.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"; @@ -122,6 +132,27 @@ &dai { status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + panel@0 { + compatible = "bananapi,s070wv20-ct16-icn6211"; + reg = <0>; + reset-gpios = <&r_pio 0 5 GPIO_ACTIVE_HIGH>; /* LCD-RST: PL5 */ + enable-gpios = <&pio 1 7 GPIO_ACTIVE_HIGH>; /* LCD-PWR-EN: PB7 */ + backlight = <&backlight>; + }; +}; + &ehci0 { status = "okay"; }; @@ -157,6 +188,12 @@ &ohci0 { status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +306,10 @@ &sound { status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>; From patchwork Fri Dec 10 11:17:10 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1805 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f199.google.com (mail-pg1-f199.google.com [209.85.215.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E3EA03F15A for ; Fri, 10 Dec 2021 12:17:50 +0100 (CET) Received: by mail-pg1-f199.google.com with SMTP id m129-20020a632687000000b00324df4ad6c7sf5014890pgm.19 for ; Fri, 10 Dec 2021 03:17:50 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135069; cv=pass; d=google.com; s=arc-20160816; b=0NbuFhdz0oY41n5nGQWMQL66/xHDmJWao8GaK/UdHx7yABeMY7Ygq37siaHPJ31YW8 fOf3KdEdePQ97OoB0602dRHPafpGTjGrqHLEQLSbSooKs45Flc15JzdeYRLdaxGrbDAK o2dFuJP5z6rb5uzpCNtcTw4IZTyOdKRcwoghSeIbmny4SXOI/JH5x2LnMN2Nq9ONPJOO VMPjZ9oEbS8wImNVDJhoEQC1qjQZ6MtKnP7ZW8frF6F95zGiUIHJgFj5Ud1g/i+K41tq wH2Jygk5bx7jVaCeR96XuKXbWu5fMhVRdLJrb6tX/sgtVReqIRvTFqwxdWqm1XY1Clac oIQQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=KUkz1HFG7DqiUbQFeiys2aT+UZtK28dH5b1m0TJKH1U=; b=VQWSGscGbd/WPhdVflWGDbBW+do4opqs7iqX1amHJplIQp4N8Uierz1Cyp8H6PpSKp xSUh/ZMC/GPi6+npiz8hNCSBTs3K0dp9yMf9+Hv1lxGyXutqxBZoFmLZS+vEwemoDq2f 5NKsSK5hcFOGEAGQjaNTRO17iehZy0eammx4FoBVGd4g4msLQPoHZgu4ToTxJGC6P3R2 m9ureUvyD6qy6xL0AHFWSULUeCBuJF36xAJ+FacormICX7VTAEDFzeLC/RVgsFJg+fJw Kd9w3pqGfm/wzWV7j9Yv+P9ayxS2diDYUNtDRMgtkIndW3r6Tzdj9i1gfp6JayIF5rFx rOKw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cZjFf3cN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=KUkz1HFG7DqiUbQFeiys2aT+UZtK28dH5b1m0TJKH1U=; b=ir3da0na99cA5UEo/ABrDP4p8+NrNDn2PW8edyVbK4MTnrGkdF/K0at5sY/mFThTvb zXXuWnpwt1bssz/jyBxhbSpxOcNLLtFUOm2eN35K45sJhDplfw2KW/n7KYf4Qtfw3lUi d6NN/LT4UhuqebOhxh84R9hlD+z6XmRGYsIE8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=KUkz1HFG7DqiUbQFeiys2aT+UZtK28dH5b1m0TJKH1U=; b=Z6KpNR3vdg/XlzvMWgoRA5IHquT+S5HKWIPnQViiW+RiNMIPwxMbE3S0UqrPfcMqG6 6pHSBLN6uqKFXFKdJfxLhjYM/+GhugHRZEgZCmB0z34mHU7tCeFRDFDSO/1/AUI0btOt s/0cDoeqp/6slY1UB1MHjdEbjvP5LdmHx8114yRCrw1+NpdCuxSFWp3w5Sju0mSz7Afm 8miixpmP4PdeNU5x1C1ECW+wGY3GTgnwhCZCR7JO96eVOhX7cHKQG1ZzXhASgaWGeQYn ZZ3Kr3tf051zlaiZKhf87/sGcwzLYNconSPF0v3cW7pg/XITYK5LQyfb2IBcDJFj7+cD yZnA== X-Gm-Message-State: AOAM532c2ShxbuZZYuL0HRErW+sh1ebbH1VY7JQTOvdwj7XdC8LgQlsf UTr7tETWCEhti/j/TJTMH/i/Pnoy X-Google-Smtp-Source: ABdhPJz88SHXda6oDf6hNs1O5qNjFYMdTNrPIxukB1NVTHWkSymO1JhMiLsV7zVm0nO9cWyuBFoqKw== X-Received: by 2002:a62:820e:0:b0:4b1:3cea:f0f6 with SMTP id w14-20020a62820e000000b004b13ceaf0f6mr2707713pfd.47.1639135069733; Fri, 10 Dec 2021 03:17:49 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e5d0:: with SMTP id u16ls4817062plf.0.gmail; Fri, 10 Dec 2021 03:17:49 -0800 (PST) X-Received: by 2002:a17:902:c404:b0:142:4c7e:ab8b with SMTP id k4-20020a170902c40400b001424c7eab8bmr75173341plk.10.1639135069071; Fri, 10 Dec 2021 03:17:49 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135069; cv=none; d=google.com; s=arc-20160816; b=gzMeoGu6n2qUyXf/8LOdunsKnFcHD9q+VHHMf/62N/9Y+IZNptqf/Gx2twrb/hXy7K 8QrISscZ3t65WwcKWKJ4OmV70N4D3XYm2ddOIU0dfk200aoSGVnAKvfDune5RJdbkcnH +xCt8EoQzjheqGSDErJwR0e0DwJo54nRVdsJcYWlYFzzNoYfGAIeIsYPXbRqYMsGDaSC IYCbywA6OQHJZBaskbvm6j2noR1ZTW9alXPvn2bNyVgwlp04yVi4cqyQDktIg6GqGbs7 T1f0H6Fwq5OIr8nr+W29PSOShUAEuLQkuYFJ0gUA+roxt6YOMg7Bt+DA7loOhW7KySo6 oz8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=4LeTyuQUOX40vOSJ+axYvrUW6lyOFj2kxIyIdKNHdkA=; b=TeOBrgzzGO8pbo1sRKHd66iTxbRc/nX1A5gLm/QPbVVB2bFIaCFkyHNI7OtKGoRBlY mAcVx1LYcCV46Wr7Hh/a5MAdRXzgkgX7usNAP3/7z2FATinRSGcpbbNOl1uFZUSYErje IQT4iKs6f/Vw/vFlCogxkVe/uOY5RyGwKu4TWPBQU85FORV5TJGJIw+4HgW8miQnTyno dBylx2Q3/OvElu3NltteJYSRFlb4svjYVGK5gKdukNcdyF5zdh+Ij9em24/W5yFxVntV zhwCWNICD3QRVjHcfFXWlD7ddAxrRt9FzdJYqIqT8hsYdXTdmPqCFun7cCykQMo6Ejv8 zq3w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cZjFf3cN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id k19sor2314851pls.44.2021.12.10.03.17.49 for (Google Transport Security); Fri, 10 Dec 2021 03:17:49 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:902:ab0c:b0:142:343d:4548 with SMTP id ik12-20020a170902ab0c00b00142343d4548mr73742135plb.14.1639135068822; Fri, 10 Dec 2021 03:17:48 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:48 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [DO NOT MERGE] [PATCH v6 5/6] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge Date: Fri, 10 Dec 2021 16:47:10 +0530 Message-Id: <20211210111711.2072660-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=cZjFf3cN; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Bananapi S070WV20-CT16 is a pure RGB output panel with ICN6211 DSI/RGB convertor bridge. Enable bridge along with associated panel. Signed-off-by: Jagan Teki --- arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 64 ++++++++++++++++++++ 1 file changed, 64 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts index bf5b5e2f6168..501666dfb5ee 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,38 @@ &dai { status = "okay"; }; +&de { + status = "okay"; +}; + +&dphy { + status = "okay"; +}; + +&dsi { + vcc-dsi-supply = <®_dcdc1>; /* VCC-DSI */ + status = "okay"; + + 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_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; +}; + &ehci0 { status = "okay"; }; @@ -157,6 +211,12 @@ &ohci0 { status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +329,10 @@ &sound { status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>; From patchwork Fri Dec 10 11:17:11 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1806 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 94B683F15A for ; Fri, 10 Dec 2021 12:17:56 +0100 (CET) Received: by mail-pl1-f199.google.com with SMTP id s16-20020a170902ea1000b00142728c2ccasf3879016plg.23 for ; Fri, 10 Dec 2021 03:17:56 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1639135074; cv=pass; d=google.com; s=arc-20160816; b=Y18kun8WSmu01fWJqRaCVitw2F6ZrU/oLQu4FdiTjiVgw1I9kQxMqNkBpRStnxBBWd cOuBK3Ff+opgzhEbmp5fmQiRdpbprG7Hoq3QN/J/cQu40/eHlUwBlxhAoPrQl73KXqxz jYeKIIOT3ASgLmFuJMg8jQ3C1HgpCIFVPwgiYU1zUpdnN5ZC0opvrNG51D7brESx0xO5 bunfOQcwvXqfGLOCjCIRY0LXbJRDtqAWRyDCVRjEnt1p/Gld4w9C9DCzzAo1Ef0AbBh+ NQJWWc2vSLHYL6a9jcE8dODZ9F9RccKPXOpZmseNApNqEeNaXNUAY+gVtXfSs69JSGR/ vJsA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=AatOKwGr/WFqpEtAZ+D05mOzq7TRpe8Hj/8NtnXJQ9g=; b=gmLhaSW901+mJB0wKfvyhWIPiw+9wsVV2TSOopo/35eI2t/9loa5YpBmcxm+mn5txS Wwa7E9gxGMPO6/6qSCyw98cbLnuuKoAPFu7Fuo4r/txVhMQjQtAL0s81kLCzkX8azWWP JlXgQITLCIcS+LKFKf2iVIhfar876g0Rhe8wYhOGJdsfKOncZ2hvhAWOK5S6eT6Xt9Gt Eetn8TgLnQ02TuOXqFlbZTUiYjyTpKW2k4x1HoWnohj1O316GQttYpuwRoiuT4LuIG4R /oo1rKJCmaYrKJqOJ8zpT5yAZgosVLgnkGQ0/BjykN9V3hMLzAiYcQLFnn1D4ag/1qAF 0c3w== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zg94Ty4D; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com 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:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=AatOKwGr/WFqpEtAZ+D05mOzq7TRpe8Hj/8NtnXJQ9g=; b=mF18xEBNH08Kw4uIW2BcdZCzPoBGBbKjBWlttskt7Xpy/PBo7zY32/VPiEbQYb4rxA CpeNLE9N+dk6lltoZZs0o6hQGJkahPzBdv4qyGqDNCTpknU0B+DX4bC/DUX2MsD2payC nqTvFgons0g/jpNtf11b8Sx03NQl5NJIoA6Hw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=AatOKwGr/WFqpEtAZ+D05mOzq7TRpe8Hj/8NtnXJQ9g=; b=irp1OSVkrl8UHzhwUWKWvKBKnsrUjQzxjrcsRsAs8iroI1BBsBlrM1wuqV4LHItS5w bJIHsHTi3hkOzJogsVbrn3fx/McwgcJNFb6UPxSk1aadaRILSMe5VZDrea4Dejxd/GFb IdIvpqNQdnEtcpJmx1xgY06Or1iC6VWqh7c8JVUhaDmH2hZMj7WJ8kQ67BxeK0MqT3H7 vZXRQ5QywZCriaPGmV/izR3t1W5PHGn+H3sipk/mUAzUipM1N3KnaMfSM3Wp0xgb5nnq Xi3AZPEjZ9Iu1E88TJENnwzE+hhjF61szLmTTOV0YSRagKfLo/1nxKsQmzGPjgW4H0lN HyqQ== X-Gm-Message-State: AOAM533dKMHBQP8W6gX7A31PGqX3QmQMxgtZ14wOWyantE65g7QK3Yh0 yQbpdwYtowHgWuXC3yfvrQlr+Qf3 X-Google-Smtp-Source: ABdhPJzKSWoyiLsPdOFI5vbp935SHHlgdEPOn4r43QDHTaL/1eZf8dRLIyQk8jgg0qIuiKT2s9hWDQ== X-Received: by 2002:a63:b90c:: with SMTP id z12mr23637610pge.584.1639135073987; Fri, 10 Dec 2021 03:17:53 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:99e:: with SMTP id u30ls3297107pfg.7.gmail; Fri, 10 Dec 2021 03:17:53 -0800 (PST) X-Received: by 2002:a63:ea02:: with SMTP id c2mr39477647pgi.54.1639135073301; Fri, 10 Dec 2021 03:17:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1639135073; cv=none; d=google.com; s=arc-20160816; b=QEPcIlU00mCWbu+I5UhNWhlOSxkNbJn6NEV5xEy90vanQMfpphvTTOLNXvpZHpJtBY ugfjqye17/wNRvIlXV0CXUzYh0MzRmhJKlIdEAUA7NCw9Yzygp0JPKCVhjFRCedHHA3N PKbDBXzgPg31xjCvusa6lR5nTILJSjkibyyOvJJ7w0pvlZQAsL9v3u1LJtJqs6S/HYi+ iUu0wt9eC+nOjREpHHMReXCYZWLe5uozHm4WQ499v6k1JwlRn/6lVSQMsggf6jRrxYkm Yt491UShob8AQG0cRqAgnYrNf/76pKFzUiNzve6tzUbi1b/tBGqJnWnUclZCQidmArh7 TS6w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=Y58f/408ggFS0t4Z6wIbn0XNvGpa9gF+cq3fnKbXvq4=; b=eC8Hv1t4Oaml9Tg2CDH+tGHQfhIRrI70c6yIXmu7J8+/ePhCPtaLhBn5hjPPVGw0+V dpdQgNGHIVDwTyVm73FKFNjh5PfCYWQv/Y0ANeSbvh2mx0x0OSNz4hnf9NtIKMtfaT/T 30uxpXNkdQYNXSWKg26MgITf0vi8LocoVcrybBa1fHg2GoqBY74ntKudpUvBbdvbOFvo iPgAWNixsRBB1O5/UmmcxtztlWD1SQN6yJ7M50ooyaP/aincAon578Kx6WEzIJen6jbs NAgAqiLXMUZGjjuuqQWIcHu4rQVcY8G95i9i8sfkRJ2LkyX5QhXh8XI8aTzjjpK+6fhy 7Nmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zg94Ty4D; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id u7sor2286004pjc.42.2021.12.10.03.17.53 for (Google Transport Security); Fri, 10 Dec 2021 03:17:53 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:90b:380e:: with SMTP id mq14mr23759146pjb.74.1639135073054; Fri, 10 Dec 2021 03:17:53 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:c40f:36d4:b45d:731]) by smtp.gmail.com with ESMTPSA id qe12sm13125607pjb.29.2021.12.10.03.17.49 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 10 Dec 2021 03:17:52 -0800 (PST) From: Jagan Teki To: Maxime Ripard , Chen-Yu Tsai , Laurent Pinchart , Neil Armstrong , Robert Foss , Sam Ravnborg Cc: dri-devel@lists.freedesktop.org, linux-arm-kernel@lists.infradead.org, linux-sunxi@googlegroups.com, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [DO NOT MERGE] [PATCH v6 6/6] ARM: dts: sun8i: bananapi-m2m: Enable DLPC3433 Bridge (I2C) Date: Fri, 10 Dec 2021 16:47:11 +0530 Message-Id: <20211210111711.2072660-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211210111711.2072660-1-jagan@amarulasolutions.com> References: <20211210111711.2072660-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Zg94Ty4D; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , R16 board has DLCP3433 DSI bridge for connecting TI DMD Projectors. Enable support for it. Note: This is for testing purpose, DLPC3433 not available in BPI-M2M. Signed-off-by: Jagan Teki --- .../boot/dts/sun8i-r16-bananapi-m2m-i2c.dts | 69 +++++++++++++++++++ 1 file changed, 69 insertions(+) diff --git a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts index 7713cdaf6211..a96fbfd743f7 100644 --- a/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts +++ b/arch/arm/boot/dts/sun8i-r16-bananapi-m2m-i2c.dts @@ -86,6 +86,16 @@ vol-down { }; }; + panel { + compatible = "panel-simple"; + + port { + panel_out_bridge: endpoint { + remote-endpoint = <&bridge_out_panel>; + }; + }; + }; + reg_vcc5v0: vcc5v0 { compatible = "regulator-fixed"; regulator-name = "vcc5v0"; @@ -125,6 +135,32 @@ &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>; + + port@0 { + reg = <0>; + + dsi_out_bridge: endpoint { + remote-endpoint = <&bridge_out_dsi>; + }; + }; + }; +}; + &ehci0 { status = "okay"; }; @@ -132,6 +168,35 @@ &ehci0 { &i2c1 { clock-frequency = <100000>; status = "okay"; + + bridge@1d { + compatible = "ti,dlpc3433"; + reg = <0x1d>; + enable-gpios = <&pio 4 15 GPIO_ACTIVE_HIGH>; + vcc_intf-supply = <®_dldo1>; + + ports { + #address-cells = <1>; + #size-cells = <0>; + + bridge_in: port@0 { + reg = <0>; + + bridge_out_dsi: endpoint { + remote-endpoint = <&dsi_out_bridge>; + data-lanes = <0 1 2 3>; + }; + }; + + bridge_out: port@1 { + reg = <1>; + + bridge_out_panel: endpoint { + remote-endpoint = <&panel_out_bridge>; + }; + }; + }; + }; }; &i2c2 { @@ -289,6 +354,10 @@ &sound { "Right DAC", "AIF1 Slot 0 Right"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;