From patchwork Mon Nov 22 06:52:17 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1781 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f69.google.com (mail-pj1-f69.google.com [209.85.216.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 005E03F15A for ; Mon, 22 Nov 2021 07:53:27 +0100 (CET) Received: by mail-pj1-f69.google.com with SMTP id jx2-20020a17090b46c200b001a62e9db321sf8448695pjb.7 for ; Sun, 21 Nov 2021 22:53:27 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564006; cv=pass; d=google.com; s=arc-20160816; b=hQKfHBJi7I+YouXwzUgAi7d67WsbDODrRNcU+Gjx8q+18ZLtDaXA42RTb6HJe5gRt1 2UmVwTTNCJwFV3CUFnRsSK4YtzIPIuYU5HfLdjxqGNCGW/seJS6N83Ey9yZ9SVuQOs5G BRB+9RB2ncggkhs+qHR4HgH8dwBuZ3vuAARBS6HXZp2m3rI7VilzwytWqU3E2zifWMnO B/1uH/RDuQaHnEjlqIRdO6ir+uFwC3H4oxjuBksR2j6eAIaiHmvd3otHIcDR1yjUsWEx KUSHg8/sS9PnScIZ9mEMmSpdycnMoJ8S3fYDUmsZwJfR7SDd7/xH4vAFzqZr8SK75GQA ILBw== 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=FxkgGBxzCWVpEYJAZ00HK0R+Q6tWUBjdCI3JLFUxXSwAmIHyPq3lB4v9FXdDXz5zc3 0F4DAMl4qkRxvSWGesgoeU3D41jRMA5T6wgkLm0rNCxdTdRGIR6oaJnrcJ9pqwqKQRKd npvDCtdNhBNMcZKWjpUeb8Q5Vx8d33TTiOSOAKevIAcZk40mQrGIKfjpLlWUyNlP/oFs 5avuYl++Bb8DesRzIyBg5KNwPnO2ux/8Nsp1M7hZmWgrJ6KDLjkSKqoCMZkmwb0OFl2+ Wbf6xVKSUoNGjaDFT9eh6/ltXIBtWYuTWaSrGvI7BRBwyj6PWGgdeJvhGE+ZXvgf7sDh /ejA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o6wWL1yj; 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=f6WHvTrwBIaLWgQ2nzr6yTIUcrJjKcQ4Pfh/yhZQrNxrxzEe4SVm0Iipt0axAw/8hE ew1tsOfW/pf4z5n7KUqWJMk3ymL2sSB2r4IJPd5c0uyPKD/ld1m2wVdLT2Ur6dlLE7Ha 0AOhHtYgBqtb/4vlx/Nuya6IWsrmSIDdlXp1I= 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=nn6M1lvBbWHUF4krxvKfzjvLP+kNSf+Fd0CfRaJ0hQI=; b=MkPIL0hQDavz6s9HjAdxK3mJAhQTVWo2xw8+0MdMcB0GCLh0hmtSvoFoAyoVbwDTkh MAm//8syNDLhAdiM0/oszyRdLv/SsS491Gdpvl9Rf2p9OppKvNVYjnZmIOZefZ+B9/Sy PFG30RVCQXtiPyaL0CxcS6xI0aiKtiQgJiYSxxC+cbhtxrf1Inn7mrUrs8ogsYvhHm/h IjcEZUQRLszOdMDAeJZJOPMEmIa7Pxw5EaD0GhEa+PHZwUDGk+flYOGGgPcAoXGOQJS/ fZqfigW1oWpkQrPjscD9Y0CFhhyzAztsCaxSQ6iy6fCs/eTbUoPFEAUQjFmYB0X5zF3P Me/w== X-Gm-Message-State: AOAM5307rTfojWomMOmmnnKsGXMY6zsQ63seYlVX+PT6mpLWW8blHmDw fbZ+AK4qPSqrMtrW4mWa1h9qymqo X-Google-Smtp-Source: ABdhPJxQsGK/fFMi0h/ekyGs/XsuXPitXa1j0N1tRfoJXuO3avGumJN9K16TnFTZ8f7V6sW0BX+bBQ== X-Received: by 2002:a63:c143:: with SMTP id p3mr32149608pgi.366.1637564006309; Sun, 21 Nov 2021 22:53:26 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:194d:: with SMTP id 13ls1407019pgz.5.gmail; Sun, 21 Nov 2021 22:53:25 -0800 (PST) X-Received: by 2002:a63:555a:: with SMTP id f26mr32635118pgm.263.1637564005542; Sun, 21 Nov 2021 22:53:25 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564005; cv=none; d=google.com; s=arc-20160816; b=sFLs0I905bwGTypsmax3w9DjS+q+vfEDkDIcFfgU2qvCql5X+vRUCGnFoNHC3wgWM7 vqynhnGj2D2g8s6aM57XDRZl4+gUuyJr2N5Nl4Fk1REhJh9l3g5DqXYrQJ2CqdQnuLWO z+yiYqvtT3BeSsXPjhkaGIdshjs73bUvZ4RXOCDtCULZNoJO79GG2QoctR93OD23lAJp wxTEaXUrD6luVaGo46GytrCvu5h2nlg/6VUpJhoI3QJ634LOl5HE37n6BFEB5ua9g1E/ 7PuNajO79gcFkGWUEVXaRDKWolDeUvYdTkRNKGO3CcwIsBF3gjjtU3fYsxnT1w2ezEWl /5TA== 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=pkAuQsnw7QbljD+R+QwG40X6FsjkHXAAeazRxjeItzs=; b=oUWT2RaF19ON+xrmS0qZbjmlbpuOnIW6F46BX5wvi9rDSWzXFYFEhx1yVVk10dsJY+ GVlPW0irJmNiuYxc45LI7hvn45OKEUcawQLIuNqYn52Mc6tNbiAl3f1uuXiyYvRAPqkq tMpO0k/jxJ+a/Lozab9gybRpO2dKMg16pGyRHYvROqliIHjbVggeeZBtT1xriTIkTaC1 OzwakB1UqETwA2RSrzHEz+79DPaAko4Q34aFJZHpHDb0QW1KSpSCi9cawXzsIKngPYb6 8oI+vfJzD+QYNBvt/xoqbRomM52Rzo5h+b/Bd/FUr33iwGAcKukPhCyc4Qm7RGfpnUC8 Ew9Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=o6wWL1yj; 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 l10sor3664960pjq.10.2021.11.21.22.53.25 for (Google Transport Security); Sun, 21 Nov 2021 22:53:25 -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:c08a:: with SMTP id o10mr28275591pjs.44.1637564005280; Sun, 21 Nov 2021 22:53:25 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:24 -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 v5 1/7] drm: sun4i: dsi: Drop DRM bind race with bridge attach Date: Mon, 22 Nov 2021 12:22:17 +0530 Message-Id: <20211122065223.88059-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=o6wWL1yj; 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 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 Mon Nov 22 06:52:18 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1782 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id E3B3B3F15A for ; Mon, 22 Nov 2021 07:53:31 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id s16-20020a170902ea1000b00142728c2ccasf6944510plg.23 for ; Sun, 21 Nov 2021 22:53:31 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564010; cv=pass; d=google.com; s=arc-20160816; b=NetrxK8VJvbCN3BRaFsdW7uarU3sB6tzembPOzfnZcrME6D94ixbs9AGHosOEaxjzc QmG+zG+/oFhUlcvfmikYNkyAAlIatACG1ozeAQ35J1ZnneZP4QF8u4MmkcRC9yo4u7+J 2Vev0EbKxrMsyQ1+bnpJdLLJLoUlBTRCJR1spBYA7TLq7Dl6GQKGx9+MXCrbjopQftP1 xMxENHz+vdcilK9EhYgxN6sLwpfXSWKo/IwvqQj5NWwRuLDLWrVbJT5AawbFHwphLMRN XNLNWDB54qrDaVFY+6+bnJ3XL2W5mjy/96ymleNa1EBykfWfYvft3DshQV5DJzLprI87 6IQQ== 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=hlv4rTIb90pDxzFMwdeDfPLDEaVdSSwTYp+eifycsok=; b=cn+RXh/Wwz8+M6yIzwBhtqG+jXWaGaCqxsJTW7LRwBQgFqjvFV6gYFXxbV9Am8SIfk jZPjs/geNS55ynwAc+G8nBN1BW2q1tOHJuj+j3mGAD1WZTIfdj0BR/Woeh5A8atNvat8 Y3A+Z0ueS3lAcAfjQWjMQRk4msh4MdaW/ruq5y8/sYYZIDf36b/giNZ5wVfOYoAoPrys 0tbL1jcbU0hIdKRNQG3iRohNTTnXdbEKLvJI+Joo5htYZnV3ocd8W5bc9HLQZ2yw+OAo YTsH2W+XFncfpKBVB3kxqxkPj7IBt2wV6E+man1JnP3zcBFZA4NC13EXngyYFLaTFgS8 VN5g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QPVgrYGL; 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=hlv4rTIb90pDxzFMwdeDfPLDEaVdSSwTYp+eifycsok=; b=fkPbfmkkNkseWmaTwAnUu0kUJ8R7zuDC0qimXSoCAz1eLyGbaVs05HH7bIxWUogpom 4m7WAvUsWiF5u4CS6phV9jgSe2bdb9irAH2o2HsMCQGAslO2r0A9NwxYimSG8f84ysPr Ypx3vqGn8EX+YtkhMQcsDCtIUUXvXpfaRTrYk= 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=hlv4rTIb90pDxzFMwdeDfPLDEaVdSSwTYp+eifycsok=; b=EKrnWl1NUZtHdvWjcJXrq5X3AdkZWPz09EO/vqWKmfZfVCYdF1N+XhpX3V+ArY2qnP 8HdZUszYrs6XJSdf18o3iyxxcU7U0tTLaaS+BTU2pj9e44CBrMtN/dHkG64e4J31FL4i qEUTQJT9BaBvVNIx6sMlLez4Q1nqJrRp6E9PdhcVHjNvQcP5SVJYabzWCH+jbHHwVcWY RvoB+4l8AyLhLhlE6m0cnC6HTy/cGhpVGMakejHfe+8JZpl2ED9sn+a6/Qfr0dXwplpE KtvqJftC3uTlAko/6N80lEKuO/3ou9fgTYtS+Bor0WLqwDhkdTWjMmkkjqmiPZ5k3HTv dNWw== X-Gm-Message-State: AOAM533K/KH/cEpoxhzTX/kMCLQwWqGVVCmgT3yhJ+P6yKGdGnPokXks dsK44TgSidK+yVGsnoGtxMFYu8K7 X-Google-Smtp-Source: ABdhPJxot2s/HMLHQ2BLHa0idHFg4ymRfT0P4hyNhYeFEtefRe9hqCOGEAvvoXL/tFO0AfGwH+ug+Q== X-Received: by 2002:a17:90b:4b83:: with SMTP id lr3mr28508805pjb.98.1637564010713; Sun, 21 Nov 2021 22:53:30 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:e749:: with SMTP id p9ls4023366plf.6.gmail; Sun, 21 Nov 2021 22:53:30 -0800 (PST) X-Received: by 2002:a17:902:7616:b0:143:a8cd:ef0 with SMTP id k22-20020a170902761600b00143a8cd0ef0mr98651234pll.48.1637564009932; Sun, 21 Nov 2021 22:53:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564009; cv=none; d=google.com; s=arc-20160816; b=uSfyUwJNTRjZDUHOMKwlIZx6wrPSbZrA+F9Mv/HkCy8AHXgXNr6yejTBDLT0kUEX/c P1Yy1hxN68gECqSNp/N81RlSxSKy3heeLH9UXZ8q5+2ZMdcG+QmBedvgQCS154lng+pU TIo7FJ3ICzrIUvhGqDWsrWDz2k9w1BmK5Ybcoemxal1nEvry38tRejTxE/yQxEke0Nyp tnPiUZhUB+4W64ZFzNZvowMD5I5PA9SirTSdxXe2TKbO8T3d/rk38qkMuRN80xoT0BL7 sV4pdHis/b0qTycN5VBUZFURaEdsYPaIYfXkSo3zHIMkTy0c1cvIupwoOaj3ftIBpr2S PL7A== 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=CqcHDPI5j3BreTYZLwb22+vjVwocrgSYWGCGb32eVhw=; b=q6sIN5C92zdAdcpPlIYAgLgbkDOVnwP3ie5jYlF5+Zt5rL79GkrU02H3QUNEY6GM/3 vQVZZCpjMVPDl0NMP/rEluLq0J1qsPup8VlQlk1nFwN0lmpfUY4sC83i74KpVly289Vg XTgVKLOz5nmCNkgoABdM9hYpdtsSgLk+Hzltvgo7UUeUUAz5gOJ853PaLaektMo/OE2R 1YsNTB48w8QKWiphWIaRxbjllD0E5eW8U+uvYLF7DFgeOyoCBlmM40DLGoKh6bgdyO+N sNIAWXv7KeyOoWiO0tnlN6fXWIHtTWBEv1tNro/1HfmZxXuRxetKfksCxwsMd7+YrvMg CyxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=QPVgrYGL; 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 l3sor4057770plg.46.2021.11.21.22.53.29 for (Google Transport Security); Sun, 21 Nov 2021 22:53:29 -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:903:2091:b0:142:8567:e794 with SMTP id d17-20020a170903209100b001428567e794mr105544020plc.50.1637564009666; Sun, 21 Nov 2021 22:53:29 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:29 -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 v5 2/7] drm: sun4i: dsi: Add component only once DSI device attached Date: Mon, 22 Nov 2021 12:22:18 +0530 Message-Id: <20211122065223.88059-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=QPVgrYGL; 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 v5: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 119 +++++++++++++------------ 1 file changed, 60 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..43d9c9e5198d 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -959,11 +959,62 @@ 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); + int ret; if (IS_ERR(panel)) return PTR_ERR(panel); @@ -973,6 +1024,13 @@ static int sun6i_dsi_attach(struct mipi_dsi_host *host, dev_info(host->dev, "Attached device %s\n", device->name); + ret = component_add(dsi->dev, &sun6i_dsi_ops); + if (ret) { + dev_err(dsi->dev, "Couldn't register our component\n"); + mipi_dsi_host_unregister(&dsi->host); + return ret; + } + return 0; } @@ -984,6 +1042,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 +1101,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 +1182,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 +1197,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 Mon Nov 22 06:52:19 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1783 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f72.google.com (mail-pj1-f72.google.com [209.85.216.72]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 2703A3F15A for ; Mon, 22 Nov 2021 07:53:36 +0100 (CET) Received: by mail-pj1-f72.google.com with SMTP id x1-20020a17090a294100b001a6e7ba6b4esf8444741pjf.9 for ; Sun, 21 Nov 2021 22:53:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564015; cv=pass; d=google.com; s=arc-20160816; b=nT0MgMpl7O3aMdk5BuaBg6ql8quxL6/8ERMp4yo/CX0Igs56m/OkQATIn7GTbAgcNj u8CvUxXfpSf6Yb62bvKc1/5EcsWR8ky90o+UFqtT0Gih+hevDtfxjw35tsthEMoxRl+b 5XeUTu0dQjF7lc/t/i3SzUQspd/ACMBl4PYiCxzPRI04qIk8aWyPnR1pdMoqcknYcFxG u5k0/2lc0svQI3FY3aT9vJKyXGc+wJ4k5Jc3nNN0eVWnqol0l1CtvLKNX5gjorWfeOS0 hO2Ct7eWtWQthmdHa39NEf6zj84IEkAiodpd8uZG1TABYsDWtEBEn1qekUavKRjm2sMM MWjg== 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=RDUaCivmG7VEGVtAWqfsSQ9AlriwBNm+z4f2tWkiqtk=; b=0VXI3uuVWY9/JCSVT4+nP+960I4W8U3hgY/9bgtx0fY4/WPlTx7Wa8hkt84MwWGMaK SLvLz+VOIYfKXHs5k9VkIVVFpN6E3ngbzI3GpFgM46pfXmc6zr2Y/lCu2TAZhqiIdNDz XuyL/OGx1wJ6jxZLKFbWgVaSynybucrgaLnroLlZZESU8uhUGudX8xODFvlwIZwzs9Qr nuuOCfCyAl6mOXacedBagb+hkNv+NCOCN5RPQ11WLjEgAy4D874owuTEFyfmLWgj8GYG Nt9K6BpOKwk8RFSd4qDe/nOS++Br7xdGLeeZ1tm4aDfmdcMn3NGnCdsXnVnbheSuJ58g hbsQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h7ZUfJH9; 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=RDUaCivmG7VEGVtAWqfsSQ9AlriwBNm+z4f2tWkiqtk=; b=oir+v2sHh8nMeMphhBBQ1d9FkGAb0+p18ezJ70mngqqtGHY26C2XyW52MqosmSa96F q42ls1s0n2pDFwg8Ha8OQmHsNFnCyuT753ednNqXUFIVdhMDhnN31DnON5iSDhDXUEWH W79QOFw5Cz4QxEG8axG4mbE6tVW7UXP/3AEKE= 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=RDUaCivmG7VEGVtAWqfsSQ9AlriwBNm+z4f2tWkiqtk=; b=BmlCyVFwWVSi+nytDXDD/ebxRxQfw4mU1CXMyBDx76BIEWkWQh6zLbGP6lVdizmKzm oPIMu/cZ4Vc8QypueYPonPh9AtcstfHvlVFRDR0LO+Fm6NrstQPR2x49nf3xq17Jr/Tw e2182QK6QVcfVmuY4z5+mg1Bpy301gclVSds6mAlVcrdJMvez5FH5iWXEw4oA+c7NVve 5CBKVrlE9lmWQ7o06Q5icNfNK8034B43T9x68oFDU5Gy9XMXRclmEz0OucVDZ32/1V53 Jpgks7eMXyXTbln17Xk1dhizmJ8eb6dAIz3CeLrIEjsAMND/yxcW4skbZPbvOo+LQmqD ZqPg== X-Gm-Message-State: AOAM533QX1O1ypGoO+l6kjZoHd6qB/TjmDc21HyDXI+Ji8Ixh+FYoAus pSKLFlNsnpWwiKFUmB5F3laYNbDA X-Google-Smtp-Source: ABdhPJyJ57W6b7JUiCkXfskiz0PPFBAKbQDV+wPMzbnk5nOFwm8uvge8hnNksVkjKfHLF7dnbF8fPA== X-Received: by 2002:a17:90a:d70a:: with SMTP id y10mr28906150pju.36.1637564014950; Sun, 21 Nov 2021 22:53:34 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:1a8a:: with SMTP id ng10ls9802684pjb.1.canary-gmail; Sun, 21 Nov 2021 22:53:34 -0800 (PST) X-Received: by 2002:a17:90b:314e:: with SMTP id ip14mr29798701pjb.130.1637564014285; Sun, 21 Nov 2021 22:53:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564014; cv=none; d=google.com; s=arc-20160816; b=cu+CUqXvHN86eWcVJ6YY908gKF4pay5lo1wmZhYTfAee1nYLeysgNa0z8sexREXCJc 40tcZuCogvWvGLrIQMCSObRdqqsMgfLhJN8iGUFAGiVxCdx2J+PFs1mo8aSjZZcGSey6 8453OOKm28PbJjh6rR5/XZUUWlqFu4JrvHZmjcPImfFhP92stD4vrDklLP3+6NPXmFuG QAoRjg7XZjhrcWB3hPSff3UIoNvg//2ux4NEAAdYH8Uxl5qgalCXo7cLjGoACc/9MqkN v4H013xPmbeHsP5ZAhEqnOEv2RyZm43t00nYifRoMsEFdPLBvFyTACLbtQxYXSoPKNE4 0KAA== 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=Bn7OMxc+0lRaKOfEDxXP5eAln8VQKH/m4PmaTGfkaqk=; b=aIMuSPQogT37sFI8VFSX4/T7P5FiVnsQKUaRbZlIL+2WsUL87byUqq7co9gYQlh+Gg febJPWeT+/BO9k1ZSQFz5gh0gaAVE2YI0uvKnDsXsrOV+6XE8vvnvxKIuZJptcYVEn6F AEvuWc64tb7Kr4tQcjSJf4A/9Ol0Fw9L6RyhBFivxFwvs3Y+IlayqQAThiJQ9cuChw/h dAlWMaV6jAqMAfaruf7c3f7rqcyf4iNiBeq/C8oFjw0JK9459h1lnkXRee5INc3zvgLQ ap6juD8ruwtgpAstt7zEuS/bnkaQX9v7DJGcd6u9KBshw/pxLfMmvJ7P1J2T91RWLYGT wtIQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=h7ZUfJH9; 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 na2sor12331441pjb.43.2021.11.21.22.53.34 for (Google Transport Security); Sun, 21 Nov 2021 22:53:34 -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:350c:: with SMTP id ls12mr28224649pjb.197.1637564013943; Sun, 21 Nov 2021 22:53:33 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:33 -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 v5 3/7] drm: sun4i: dsi: Convert to bridge driver Date: Mon, 22 Nov 2021 12:22:19 +0530 Message-Id: <20211122065223.88059-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=h7ZUfJH9; 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 requires DSI Host to handle drm bridge functionalities in order to DSI Host to Interface bridge. This patch 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 v5: - add atomic APIs - find host and device variant DSI devices. Changes for v4, v3: - none drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 112 ++++++++++++++++++++----- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 7 ++ 2 files changed, 96 insertions(+), 23 deletions(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index 43d9c9e5198d..a6a272b55f77 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 @@ -713,10 +714,11 @@ 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_atomic_enable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { - struct drm_display_mode *mode = &encoder->crtc->state->adjusted_mode; - struct sun6i_dsi *dsi = encoder_to_sun6i_dsi(encoder); + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); + struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; @@ -772,6 +774,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (dsi->panel) drm_panel_prepare(dsi->panel); + if (dsi->next_bridge) + dsi->next_bridge->funcs->atomic_pre_enable(dsi->next_bridge, old_bridge_state); + /* * FIXME: This should be moved after the switch to HS mode. * @@ -787,6 +792,9 @@ static void sun6i_dsi_encoder_enable(struct drm_encoder *encoder) if (dsi->panel) drm_panel_enable(dsi->panel); + if (dsi->next_bridge) + dsi->next_bridge->funcs->atomic_enable(dsi->next_bridge, old_bridge_state); + sun6i_dsi_start(dsi, DSI_START_HSC); udelay(1000); @@ -794,15 +802,19 @@ 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_atomic_disable(struct drm_bridge *bridge, + struct drm_bridge_state *old_bridge_state) { - 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"); if (dsi->panel) { drm_panel_disable(dsi->panel); drm_panel_unprepare(dsi->panel); + } else if (dsi->next_bridge) { + dsi->next_bridge->funcs->atomic_disable(dsi->next_bridge, old_bridge_state); + dsi->next_bridge->funcs->atomic_post_disable(dsi->next_bridge, old_bridge_state); } phy_power_off(dsi->dphy); @@ -842,9 +854,25 @@ 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); + + if (dsi->next_bridge) + return drm_bridge_attach(bridge->encoder, dsi->next_bridge, + NULL, 0); + + return 0; +} + +static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { + .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, + .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, + .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_enable = sun6i_dsi_bridge_atomic_enable, + .atomic_disable = sun6i_dsi_bridge_atomic_disable, + .attach = sun6i_dsi_bridge_attach, }; static u32 sun6i_dsi_dcs_build_pkt_hdr(struct sun6i_dsi *dsi, @@ -966,8 +994,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) { @@ -976,18 +1002,26 @@ 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) { + 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; @@ -1013,16 +1047,46 @@ 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_node *remote = device->dev.of_node; int ret; - if (IS_ERR(panel)) - return PTR_ERR(panel); + if (!of_device_is_available(remote)) { + /** + * I2C interfaced DSI bridges will register DSI host on the + * bridge drivers instead of conventional device. + * + * Those are probed via host of_node instead of device of_node. + */ + remote = of_graph_get_remote_node(host->dev->of_node, 0, 0); + if (!remote) + return -ENODEV; + } + + dsi->panel = of_drm_find_panel(remote); + if (IS_ERR(dsi->panel)) { + dsi->panel = NULL; + + dsi->next_bridge = of_drm_find_bridge(remote); + if (IS_ERR(dsi->next_bridge)) { + dev_err(dsi->dev, "failed to find bridge\n"); + return PTR_ERR(dsi->next_bridge); + } + } else { + dsi->next_bridge = NULL; + } + + of_node_put(remote); - dsi->panel = panel; dsi->device = device; - dev_info(host->dev, "Attached device %s\n", device->name); + dev_info(host->dev, "Attached %s %s\n", + device->name, dsi->panel ? "panel" : "bridge"); + + dsi->bridge.funcs = &sun6i_dsi_bridge_funcs; + dsi->bridge.of_node = dsi->dev->of_node; + dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; + + drm_bridge_add(&dsi->bridge); ret = component_add(dsi->dev, &sun6i_dsi_ops); if (ret) { @@ -1040,9 +1104,11 @@ 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); + drm_bridge_remove(&dsi->bridge); return 0; } diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index 61e88ea6044d..d269304691c9 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; @@ -30,6 +31,7 @@ struct sun6i_dsi { struct device *dev; struct mipi_dsi_device *device; struct drm_panel *panel; + struct drm_bridge *next_bridge; }; static inline struct sun6i_dsi *host_to_sun6i_dsi(struct mipi_dsi_host *host) @@ -37,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 Nov 22 06:52:20 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1784 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f71.google.com (mail-pj1-f71.google.com [209.85.216.71]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 340A33F15A for ; Mon, 22 Nov 2021 07:53:40 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id b8-20020a17090a10c800b001a61dff6c9dsf5500232pje.5 for ; Sun, 21 Nov 2021 22:53:40 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564019; cv=pass; d=google.com; s=arc-20160816; b=dFR3mSaX3FN/MG6kr8UoBdZ6mjp1lXdfXh9plyAZw9hXrl0mFYKsks/hW8Vb3thav1 OjY2jabO2uUkM5y6ZskG7KVmGE5KGFcFQwODoRDHt8RitjU3XV2OElRxX5EBFUqq2a98 6lFGjoN0IkvH5BswEdgv+ihf4VXp7ssEsXJiTMEUVI3I4YWK1/d7cyDb4FR1zdi4kXpo GZoFLTSdKsx3d1ygXotz5TUvh+Bj2SGSE6C7r4CzDHjrpPIQqGpMVM7IA+vWfBhExhZQ JCJUEMDigT8dZFqLFHVr5JCSbwOylZaIq7aiPEDbXAQrdUy4ESsCOQymbLOnTBVf1mri xD5Q== 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=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=yK/n+Lfv0oguZy3eULTutnbf0X6fiCQwFePN25AeSPDq6A1n3P0aIk+94zaCtYgJ8w 2KVOGkDcUDnyxVoW3UmH2AaT6XNg0UNJHdLEYGgnO2YuxO4S5iyEWnY6Fv0gRMfIUH2W 5IvttqShH1KkJZdEFSSaN3aUQ3nBS1hqkjXfgY47ex0Z/Bdd9mSZOAY8kz9/ptuOtTO5 mn0U0T8m7kQ13JfpR9bxMDGz+3te3VFkrzUxWyk12ftrBLSjL0+xFiFvS9E88d/4Z6l8 Afn+4fqT2sOKvLXWgJ2TGphVo+1vc2BtlolNRLit8OeWpCCtdyNYI6+Wf1A6u2qpj6SB tfmA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bIadhJCz; 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=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=dMSCFrxSawH6T8KVbdpTyWDXZ89P4M6ECzFEhFWQFjJhi8VcJFYwTB4UaUc0vHR+uN LT9lbKRUKfg15mZ7srYM/Aqdu1QslVUe3ceyWnHsNfpfFl+//GOUYCn7ZpyTSCtf6heU tTrZNlZKgzQD2JqWF9xDy8x/jnEBUqTCQ9TyU= 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=5lPxhlMyKjftImxO9PdCwhCYlbmhBGJs5oDaXwoJC9c=; b=VbUCBrKAqjADxjFklFDHpkXh6pJU1Y886LCv9u0ZbbtpRCrzo2vnX154AFF7iVmmnj JdlcMiBXRrEZcxSXz45ZwokyMw0pHVJlVyHRupXWfoaO8d4oxWYmFxgSfE1Uh8yTjyCm EF4PN30xVNXCclypdCou6Pn8oR+OkwZDFro1g07+FCp9foRpKJ9z8k3vQ4N3IGw6o7LU Ef2O9zxVgP4lnjc3YY/cFXK2aeRycAIQRC4VlBahW6yjPKNz6w+1fDXBtzDFNQHAmGLn rNmrvVuFLcKlHwudHnra2a1vU932Q6peWzxYMtuQXxY+YMGi98YWOzDOjgnHA5un7pep 56xQ== X-Gm-Message-State: AOAM532gEJhfWg5NDWzKZMDKQru38YMmSPnYDdMVMY6aiNs0YEPQ9M0j AzXty2Nj0P3Naf3ouIr1nyjUrTIP X-Google-Smtp-Source: ABdhPJwsMBj+fgp29XOoGEnoBjwYQfluu1pgKRiFe2lX53NZv2wvJzd2YWhJEHD2EjHtP0DVO4dsJg== X-Received: by 2002:a17:902:c245:b0:141:f279:1c72 with SMTP id 5-20020a170902c24500b00141f2791c72mr103361082plg.18.1637564018956; Sun, 21 Nov 2021 22:53:38 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6a00:a81:: with SMTP id b1ls2397254pfl.3.gmail; Sun, 21 Nov 2021 22:53:38 -0800 (PST) X-Received: by 2002:a63:5646:: with SMTP id g6mr31226652pgm.216.1637564018289; Sun, 21 Nov 2021 22:53:38 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564018; cv=none; d=google.com; s=arc-20160816; b=yNz9hOdrJ9P0/K8b0JlD5Ou8L1p5d7nvGwStHqOTzIcPtEBpgo79qSrT34yB0zZwQa fU8V0BTVyrLfPXkwUMSOU5r3ZhdWEV9RoB9DQ4G0dkUVV29JrpPPVFDUif7gbLoJLZaL v4raEoiJHMXrkHyjoIUbcwprRon+pvCDexXF6yKYd5X0vg0FlyNsIjh96p53TOWD5dwE WCsH5avsaOBChpvyStAd2XhapSWBlP26n8f7+gRl/I8aj5YnVZO5XUsjkXfc3hCwgRDw dxU6Eolw/DL11T+h+yOL3a6KGnQQyY5iUjyR1USjzq+ACyEpTsrSZoXZTsdaxh1XSvtZ iJog== 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=wJ/t6jM/jyN5QXpQAEFQjSGSqfZWlxA85S7ihcjleN4=; b=lkl8OMBKRH/urNNIP4wMo/R5QFoJS9odoEtadCH/xclRNHVUe5eXkW4/mpSLdLISGw aLkNzjJNIDLV0xKqWo8clcBJ2QrVannG0TUbLVbLeuPBe+XZFHGy1ul6MFAr8nCg9wLH JCO4x9Y3HujkrYhfsdX9tTMx5IllB+ukoT+R+yG0dY2GTe6MWbt8HZrZsZuz2cecK3dR EjsoP5UmADzFhWLsatx8yK7psXBw/7BVBkYT/aHaE1Ag9QIAl1haooV4zCH08ms7qEd7 FTfBJlv8JhJCzdH+v+xewUy9e1gUNQ9kLbSmoN62KE6jOCykeWm+47q20EaAJcLLr8ky Wpew== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=bIadhJCz; 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 na2sor12331534pjb.43.2021.11.21.22.53.38 for (Google Transport Security); Sun, 21 Nov 2021 22:53:38 -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:e7ca:: with SMTP id kb10mr28171937pjb.8.1637564018014; Sun, 21 Nov 2021 22:53:38 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:37 -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 v5 4/7] drm: sun4i: dsi: Add mode_set function Date: Mon, 22 Nov 2021 12:22:20 +0530 Message-Id: <20211122065223.88059-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=bIadhJCz; 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: , Get the display mode settings via mode_set bridge function instead of explicitly de-reference. Signed-off-by: Jagan Teki --- Changes for v5: - new patch drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c | 12 +++++++++++- drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h | 1 + 2 files changed, 12 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c index a6a272b55f77..731af31e2bde 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.c @@ -718,7 +718,7 @@ static void sun6i_dsi_bridge_atomic_enable(struct drm_bridge *bridge, struct drm_bridge_state *old_bridge_state) { struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); - struct drm_display_mode *mode = &bridge->encoder->crtc->state->adjusted_mode; + struct drm_display_mode *mode = &dsi->mode; struct mipi_dsi_device *device = dsi->device; union phy_configure_opts opts = { }; struct phy_configure_opts_mipi_dphy *cfg = &opts.mipi_dphy; @@ -854,6 +854,15 @@ static const struct drm_connector_funcs sun6i_dsi_connector_funcs = { .atomic_destroy_state = drm_atomic_helper_connector_destroy_state, }; +static void sun6i_dsi_bridge_mode_set(struct drm_bridge *bridge, + const struct drm_display_mode *mode, + const struct drm_display_mode *adjusted_mode) +{ + struct sun6i_dsi *dsi = bridge_to_sun6i_dsi(bridge); + + drm_mode_copy(&dsi->mode, adjusted_mode); +} + static int sun6i_dsi_bridge_attach(struct drm_bridge *bridge, enum drm_bridge_attach_flags flags) { @@ -872,6 +881,7 @@ static const struct drm_bridge_funcs sun6i_dsi_bridge_funcs = { .atomic_reset = drm_atomic_helper_bridge_reset, .atomic_enable = sun6i_dsi_bridge_atomic_enable, .atomic_disable = sun6i_dsi_bridge_atomic_disable, + .mode_set = sun6i_dsi_bridge_mode_set, .attach = sun6i_dsi_bridge_attach, }; diff --git a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h index d269304691c9..acdd586a4157 100644 --- a/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h +++ b/drivers/gpu/drm/sun4i/sun6i_mipi_dsi.h @@ -20,6 +20,7 @@ struct sun6i_dsi { struct drm_connector connector; struct drm_encoder encoder; struct mipi_dsi_host host; + struct drm_display_mode mode; struct clk *bus_clk; struct clk *mod_clk; From patchwork Mon Nov 22 06:52:21 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1785 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f197.google.com (mail-pl1-f197.google.com [209.85.214.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 69AB93F15A for ; Mon, 22 Nov 2021 07:53:44 +0100 (CET) Received: by mail-pl1-f197.google.com with SMTP id l14-20020a170903120e00b00143cc292bc3sf6976788plh.1 for ; Sun, 21 Nov 2021 22:53:44 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564023; cv=pass; d=google.com; s=arc-20160816; b=x5atB298co0fTCDOrz6iyZzGHcsaj8Ch895vkefI/3iLLavgvvbqVLD7JKfKLeU6j8 OWIm6czWq0TouJyVl2GGlwMPTsbbkUfJpmvEBPR0SPbeDD8QdjvHv2lot2w01F1vs8+P JKplX/LsejTLUBUxJsvyG/bxm5f4CCnvCzVYAKxMYcnVDqKfx/W7fYs0ag4fm8qXtKUc oQdsCH+MTS8kff+FNytyCc9xnDftzll1MOjTzv1WIbADzjIYBWYzga8Vtq5P4xdJPoPz Hz2QojsRjvltVSxyFkv2lDEFKvtuXVjO5Rf0ybDf9OZaPiqYv1M8mi94k/qOuq3kHmKn /0yA== 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=9Vk3FeR71ZwXXJktCy6sDGvTakjVVOOa5RHqAc/Rk0c=; b=E9MrvlU4+6pYdkFOcK21Wrjk/yLo6aO0kM6xR0OODyaBkP++2Gy2Ymv4rAVAAoRBxY doxMmmsYbX6xj539DJrUgo0xHkUO8d2Qi34diTFfF8avwt06wEl5yEXRujFkLUnLcCwh AAgPWMwAzl81LTjX2xXx8yaeJfZer8wDPzsB2BJd6Z33HJGYa1+4o7g7EAq/raNer82j LqIz5bHN2EJd7Rd0T/w6H2H3+LIyC7EmLmAjzCDJYiLQ+oTDpW0ErDQFew+PTlO81EEH ITRDb0vJzS7T6pNyZ4oCTYFctNW6SwAjlQRhfq2vsTcDh3hsFXCWIQmKbCc+IZGo8idK Akxg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PaV53uN3; 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=9Vk3FeR71ZwXXJktCy6sDGvTakjVVOOa5RHqAc/Rk0c=; b=APiiFQNp3uSa8iQaM8VA7Sq6QH9YloEPuTBaL9pe+Dq8N4bWxNe7WQIjfXl0V6nQ+f 5LrzngRmdTSKVf+YTbRANIg84LjBrB9E15gV/TD6PKRqdivk3i6be4IjNmjr90TwplF8 ZBm20xvjSFPw9b/9f1TNEqrbhGc+KjOc4f30I= 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=9Vk3FeR71ZwXXJktCy6sDGvTakjVVOOa5RHqAc/Rk0c=; b=jQAjoRO6eGhjjNdh/Bi07AFC+B6mxEzRPLut9bFxC6F+4FOWtbJPCbSFik6/wSmKKe e/DRYXmAvQIQNDYIqnIWi92cbBdBoSFbtYuAWYffm/067zzSJKncTJb+/1dfSCZeiWE4 prFJcyDJfyNnzH17rsheUBTxK0lfy4FoilG4kRnZFlqp9iYxlQBkVRJz5Ed71X9VBhP+ 513MAen9YzN5YWX6txUV//skT+wk35SF1D1IGfKnQqMDBFyerFj7zsLYCDAJlmHSBIl5 RWLSCLW2FEtVPoYtaUWc/DzEpV7O/Q0knxUu82pER/9L9jzMQRRl3Lj7fnwAr5OVc8K7 Ok9A== X-Gm-Message-State: AOAM531Yp53IhhG4qT2bBek/0QUmfmYpuRSNkH2iiskEGMKtmYvTJZU7 ZLDiNkJVZ1pmusUV/a6J+Cr/DSqU X-Google-Smtp-Source: ABdhPJxC81lGAMFII6vpwd7LshcUZf49qqXmXU7YAEBMgP+s8VNssh8yObjZtFItIlxG9lrfWc8TwA== X-Received: by 2002:a17:902:ec90:b0:142:269:4691 with SMTP id x16-20020a170902ec9000b0014202694691mr106407216plg.48.1637564023212; Sun, 21 Nov 2021 22:53:43 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:ed0c:: with SMTP id d12ls880683pgi.7.gmail; Sun, 21 Nov 2021 22:53:42 -0800 (PST) X-Received: by 2002:a63:f605:: with SMTP id m5mr5925436pgh.245.1637564022388; Sun, 21 Nov 2021 22:53:42 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564022; cv=none; d=google.com; s=arc-20160816; b=jNCEFXi0pYe/40V4DQaHVw81FZYoDJxtekLBZ4kfSXdakD82GCflPC33qoUegY6i0s IcglzL3bXrmQgOhdMDnkl6licTWqGpbOtgmA6RyP0R3PQkV/JvjSPBDBX/ecQhvaCneJ TaPi8ns2dad+cZVWbK0KciqKlApsjIHpgvlMJTjP2KtxkDroJ7mx3TH4Ftx6H6q0ZEjy LkR/M1S90D/z1VuxnalTHuDAb36wIvPFm+TrQGxF3yfag0vOgvJIg8F/3IBWP8FH3YxM 6DBTOHotmJbzWImx7cbfNzVrWw5gHh2gmWzrvKYY2aMLPyJt7+D9W4vWsaxV0n5ytV7J VtUQ== 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=6ZYBayqIBeNPyf7qiUQrCfEnJGA1MHxlxCodqslkh4s=; b=Q/QrDJrDJTgBmKs8EkhSGG7+flruPQLbv0hrvrs3pGyCSxKt4POlQMi6qw/j8Ws1bc mqKRy9Y1LuOguP4k13FaIPledVkX+n1s7tWyCSjH3etV14TesOxDWkHNIO3AnXStJ056 GB8OiUQM2B8qwz7sWhUGPmONAWS3hNrFcAuLVIqIx2UUGPS1J9pnr1yWcnuSj3gg8dnV /KQ3oIMCzzeK9QLIOFFE0Ch8J7wGTNkeJw53TIOlQZqdD70AypzGhZ/mnPMLrvAwl/86 aZWBeiv+pAMNQXJjB8do4piYUIFGbP7Rl2NruewUOzISwYh5XpEZNzuQ8m1UAGNS8HnN Y/5Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=PaV53uN3; 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 q206sor1719035pgq.11.2021.11.21.22.53.42 for (Google Transport Security); Sun, 21 Nov 2021 22:53:42 -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:8a41:: with SMTP id y62mr31942595pgd.48.1637564022162; Sun, 21 Nov 2021 22:53:42 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.38 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:41 -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 v5 5/7] ARM: dts: sun8i: bananapi-m2m: Enable S070WV20-CT16 Panel Date: Mon, 22 Nov 2021 12:22:21 +0530 Message-Id: <20211122065223.88059-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=PaV53uN3; 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: , This patch add support for Bananapi S070WV20-CT16 panel to BPI-M2M board. This specific DSI Bananapi S070WV20-CT16 panel driver is not available in upstream, added for testing purpose. Signed-off-by: Jagan Teki --- arch/arm/boot/dts/sun8i-r16-bananapi-m2m.dts | 40 ++++++++++++++++++++ 1 file changed, 40 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..b215c32996a3 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"; @@ -61,6 +62,14 @@ 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 +131,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 +187,12 @@ &ohci0 { status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +305,10 @@ &sound { status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>; From patchwork Mon Nov 22 06:52:22 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1786 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f198.google.com (mail-pf1-f198.google.com [209.85.210.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id CBCAA3F15A for ; Mon, 22 Nov 2021 07:53:48 +0100 (CET) Received: by mail-pf1-f198.google.com with SMTP id q2-20020a056a00084200b004a2582fcec1sf9439238pfk.15 for ; Sun, 21 Nov 2021 22:53:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1637564027; cv=pass; d=google.com; s=arc-20160816; b=NRHWKGIgR/JTdXrfXKf5ZC4I0MH7N84r9JZ+i6K02OFAr5YlxHIff5pzsmsf5s5SIF NLAfKwMrRhMaY/yktyU1ROuYZ7XOb8ZMJjS917TPbki5650mc7+PTmNqJsuJE6WMK+i/ tJV7Uv/797NNvNFYt94GE60ZB9zzUYA+DPhytpBNf3r8w+EL51mYmtyBOgfmjJp2O3Pr uC1ZJNHjRysr3Spwsl0zFHng0PV/wFkjUCMnInFsmrgAIchcWKNBUvWRDrA9XbhlODKQ 87F47SB88SvJzjqm9kBOg5SvZhIVeOKfTuy77DeBa9TI+UTvBh7d8q/xcO5xaRxci6/7 XHyw== 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=/rRMTFOt7As4dz/ivWuPGTqYukkhDCaACuNWQ1b2eUY=; b=s0XqlbuqeCqhyDXt/7rfj6RMjcpE06EJqBfbF5MMFXKNRtpGKplATLhV1FRxYBeo4g CjLLaboqfGDCcv6mj8tQie6dzi/8FMSQCYKdlGik3W5LdnCbT1ajVIQEJTieLd9PXQwK jdtaEAG6JGlj3ubugWlZrLHMjtWJVjATAvhK+NgOM1Rrbcb6zyRQRcbwPUDDh5Zomnrx 3lcl9LE9neonAcYMdzxficRCOPm9xSmc2rRQveHl5zmbcmRCrurSf4q5K6GSIpii1+/H vEhUXyz5cFG2Vn3H0zkAPfdQeHNnVbT73sBJ37IGAppLn/dePAFaeK+oxpqTGmu+I/D7 qnDg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=R2lQlxav; 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=/rRMTFOt7As4dz/ivWuPGTqYukkhDCaACuNWQ1b2eUY=; b=RDeAJb60VrRZpGZX2o/kqXQvhZqGDASq8AS7t3PUnBYN9BG0NACs3AnQc+sUWG+Ek/ ggGySncptVE9N2xtG+EP3clBdn1cVNh9tYQiD6TYsFnmDv6KkusU3iJEShe6qV+byLQS FOABo3H+vqLJ6f8bGeKR35Mp9L17L4TXQ30mM= 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=/rRMTFOt7As4dz/ivWuPGTqYukkhDCaACuNWQ1b2eUY=; b=rtu50MhC0xqZr3LDoXlMFVWckn9MWhopawYwsCvJEN1DuGJRDLXMfbcOSipzxTgbPx 9GPsXbQPtSnpPluT2qZsYZn9RY2DLudR5NNKvJk4rYfKDqG4YHVueDkHSnRW295ujXfG WWmphNrd2zecT38K+YANnqRGRJnv71onDfzEm09WCbhxT+hvzoHoSRi+wflv5NntPpBx otKujlrV9+Okx8d3wAWRhRyY+69rMNqt0sfyixbCf8yYeFS8QRxeTJIWBqQt18sNd6do JYBtfqe9/bEffrNG2iohh8jNtPXlGUM7hQzBsGA3yQf6ogz7gcp2TIbeQ+0QgdsqJjd/ Ad7A== X-Gm-Message-State: AOAM532t6LiXSdszwkHuoRD5u0EBvL8hKdLGr/gK7ZIpbs1vhleJJru/ 1y3WHy+UEUqZlg1CvGvlf69ttTW8 X-Google-Smtp-Source: ABdhPJxChGk80//y757CIGtmQ2LmZ4xQV77fhdnx+aZzvj/0eVdhGdhtq1oWRtolrDC3k+UJvjbxXA== X-Received: by 2002:a63:80c6:: with SMTP id j189mr31755185pgd.200.1637564027340; Sun, 21 Nov 2021 22:53:47 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:ed0c:: with SMTP id d12ls880727pgi.7.gmail; Sun, 21 Nov 2021 22:53:46 -0800 (PST) X-Received: by 2002:aa7:8e52:0:b0:4a1:5820:d9cc with SMTP id d18-20020aa78e52000000b004a15820d9ccmr80952832pfr.49.1637564026734; Sun, 21 Nov 2021 22:53:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1637564026; cv=none; d=google.com; s=arc-20160816; b=UAfxgMA5trhV/+Z55ZHeRNyDOKv2VlQxnu1RQK9Uqmajgnp1Of240kBf2DhIrIVs0s b8SadVJMwZWkDakdgo2tkrHm+lCz2jQr66l8ZJMXn/z/GMh72fOdSzg0fuioC//hddQd 9Q18cMyjr1VZqBKPDfmdYDF1E4S+xCJMMX1MmfxNAq7+ZMehQREyTBQu+wKIPcrGePFx nWDw14i+3gS6Esvkc1/SMcEP5kP5gOJhC1mt+6TJfZyTP57Ux7p47v/XTeyFA2Y1Z+k1 4ZB8yOIAMWV8zzCDE/k5DfD/5ZIuq3rtS3DERi4JNDGOBLz0C0nzQQm6IejpVtVuICLy NO0Q== 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=xqP160R8LU5V3gmz2VYiGFoGsrEbiwdGt3q8Nn130K4=; b=cDUYEzhWmFK01akxZZIzqPBR5A3s7OSLIJ0hxEjkJxNjdzkgpV00eqQ/tM/Zb3YQ2z Wxi6HXKJKc6BO1UwXivx4qiCriN9tEbQpTufe9X98bITYfNeilh+rq2S+bFOVAzjImPs pv4aT0sonCaL9SsU+ZLCoVIXBxdsTNZhqJQmKqfeb3rRLXkaPLCSw/O7cHLCyz9Sz1p7 IyBU36/T+TCwYrPj6PXYDjpNlTHwYX+5sd6JMH6R3+ojq0FpDemPS+2zjmlyeMGTSoo6 6FHgqKxeeK5xWfj+W/YQlDyqJda1hGY/8l/xY8cyml7iXsetG3fIZlsUFAaal2hoSerJ oNsg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=R2lQlxav; 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 w18sor2025896pgk.78.2021.11.21.22.53.46 for (Google Transport Security); Sun, 21 Nov 2021 22:53:46 -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:894a:: with SMTP id v71mr12345570pgd.337.1637564026320; Sun, 21 Nov 2021 22:53:46 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:eed6:c913:819a:3850]) by smtp.gmail.com with ESMTPSA id a8sm7935904pfv.176.2021.11.21.22.53.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 21 Nov 2021 22:53:46 -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 v5 6/7] ARM: dts: sun8i: bananapi-m2m: Enable ICN6211 DSI Bridge Date: Mon, 22 Nov 2021 12:22:22 +0530 Message-Id: <20211122065223.88059-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20211122065223.88059-1-jagan@amarulasolutions.com> References: <20211122065223.88059-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=R2lQlxav; 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 | 63 ++++++++++++++++++++ 1 file changed, 63 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..da6c1f2a0c74 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"; @@ -61,6 +62,14 @@ 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 +90,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 +143,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 +210,12 @@ &ohci0 { status = "okay"; }; +&pwm { + pinctrl-names = "default"; + pinctrl-0 = <&pwm0_pin>; + status = "okay"; +}; + &r_rsb { status = "okay"; @@ -269,6 +328,10 @@ &sound { status = "okay"; }; +&tcon0 { + status = "okay"; +}; + &uart0 { pinctrl-names = "default"; pinctrl-0 = <&uart0_pb_pins>;