From patchwork Mon Jan 23 12:23:09 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2643 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f200.google.com (mail-pf1-f200.google.com [209.85.210.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 9F4113F039 for ; Mon, 23 Jan 2023 13:24:36 +0100 (CET) Received: by mail-pf1-f200.google.com with SMTP id dc11-20020a056a0035cb00b00589a6a97519sf5166250pfb.8 for ; Mon, 23 Jan 2023 04:24:36 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674476675; cv=pass; d=google.com; s=arc-20160816; b=qRnjoooBrn/E/eZ2jwZyCDjYyZwVI6DA2HWua+ROibLsIn06MfjbZr9vv3dB9o8XCm xioRJ2SaC//L6OK4eAJU9yp2dRgqhvMzXBlBu3btsJlNR/NxVL/cxxEZU2jSkU45iY57 oJmwiRT6X1WYOvokj8eUamROI6+zPQ1Yubdyppzy6p+MiJMNJ4KHIKPtqRFgAnCEA1ju womdA7J/9xi+0A01bKRunZoqaqbL1DjH6Z37jnKqgyvRCWwpn95zDqhHmp8D/vrXvB8a a/nHYY3ALG9TtxWTNuAVvjxjnCpWO75fb0ty4KXdlMzAI6+vsFjqO/Q5eX1NItxQCxNH N1cw== 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=0GG6gqWjkvQmY2OXSJkql+DSD7iwAmtuXj7/VyxUPII=; b=TRFIrGDFcZwSgclwfs3AwmfP154FC0pf0TeaK+tamNpRB6QGgqRm1DX/nKOiSmnkH5 Cd7Ryqxj44T03F+TYIEwtx1UjEzH3YqBljotTiyRfQr1wRt4672edYTDCnjeMpMsMqmc Fa2j2RmdLd7FVx9SOMh0pVYESKuoNWdunipn1LmjKFMyoacJOxvPnnUVHa++7qHCP/FC /bI7vPHz+gcA0z4hPR+2CEo51ENwP6LmUsMsLT2XhOqtvoS/k6ocvqQeOvkQ9bbqbgUl 5G8IB/i7GC7S4gtC0j01qaChoo/iAMri5YRXx2zcdDXd3NMg8TK1AU+wHNJi9rf2IVSO NIXw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="QQR+NJ/p"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=0GG6gqWjkvQmY2OXSJkql+DSD7iwAmtuXj7/VyxUPII=; b=PS47IHhuRsQPE6vUWkm087REsLw24uGhG1pEVx+EJFUoL7v2Ih/uSgEkCkDtKXCi/z Qp+Ql6QW4Tb0kNm+xzzkt2nQbOb3J5eO8C3Vclf/3NZx1zvATFgajXvepS6Gs2vs/3b3 xIKKClMUxZe35EtFHWYc6iwusSFCtqsFfLuJw= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=0GG6gqWjkvQmY2OXSJkql+DSD7iwAmtuXj7/VyxUPII=; b=pFyZY5HCMoDPzYEtaE0q4UkYub+T2XettvaLBVghtE5RMKCXJ1hFT42Pj9sqg9csOp LlOFoeFphplmG6k97BBEvh4cbDAMzuN3zLnr96TpbC0+rr7qeFnCDFsLF27uRJx4dweZ WUoL6pegDJYBiqZpur5Elm+W7STPN0zgzvs4DqYS/3c6LC358WTHpSFUhPpW9CvyT0cB o3B9o8LW94ygZiMqDsNtPMVxNpOTCPYjSoHLuW6V3LL9aymC+53P6S76g+MICUp0BOGr Dt8P7lEz/2UcaR99rOLkaC0rhE9TRAmS37l1ULCWlrcsBGg6k+rS5mLvPjbW4xhc2xB8 Nthg== X-Gm-Message-State: AFqh2kpnpS86Jvw6zpHhMJDlstysGajuJZoDTGtAxsUyLXynR1wUlULl sC8/AufoUwPhLjLWtHx8CObGwvat X-Google-Smtp-Source: AMrXdXsosamCdQsq1nu1rcbUMMxNAKWYg2JPU18Ar9AnhsiPqhTo90xFwXIWR+c7Itqc++KOv04GFg== X-Received: by 2002:aa7:880a:0:b0:577:5db0:93f1 with SMTP id c10-20020aa7880a000000b005775db093f1mr2744942pfo.82.1674476675383; Mon, 23 Jan 2023 04:24:35 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:c392:b0:22b:b65d:b10d with SMTP id h18-20020a17090ac39200b0022bb65db10dls8512208pjt.0.-pod-control-gmail; Mon, 23 Jan 2023 04:24:34 -0800 (PST) X-Received: by 2002:a17:902:ca13:b0:195:f265:66dc with SMTP id w19-20020a170902ca1300b00195f26566dcmr8327656pld.68.1674476674467; Mon, 23 Jan 2023 04:24:34 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674476674; cv=none; d=google.com; s=arc-20160816; b=El0xAUH4YihAT7K32Dqvn7uU9pCaycjQDo473a0SvKPmuRpuVqVhYzlbu6x6K+4CGR NtzDEqBowiOeybd18QpbZlrvomK1P7xeBY+zV/w/hfOptfE1qk8TT1nLMMjwgmlrpwrr n/b9l1LGN9cENq+fqVMfKGltszdVp6hb/lZHPZeiVfTdezJ8TJscG9QssziaZtW9GLh2 VAz5s4n2v9f5Tp8SVOly/6GOraU6qgkyI/0arGXOnmzYo1cKT5EhAKzEOj4vHcEyD/jE W//iZYjGZwufn1GFTkSM/sE/hsJo1QocGHuNHH0byO9Ewy+ytNDXHzbXOQmp9xbJ0kMQ dVPw== 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=ye7rK8XP7CKFg3FA4ZUZc/27br4/mG8uE4vofYp7eK4=; b=ZFSImHgeCxTzSRecxeOPgmBkWO3PQZsCBTHSec7GDYgVvEz/0uCKWnvI0Xtf5vE4OR 5UziPje4WIQ/wMOLMy74GkYDgp6kFueleTxN3Iz+gJNiFOi9QfJbdmkifj7cZEoQwqAR okKVuTlYbBIYCYmB3/ZAOfQUYvtXSOA2cJ2gSf9llOIDLECViRcp32Q76H1RmXdSYLug ZMNBnjg2SL/wdNgcYz7GYQzUYK/fyrrftfaizLOOv9gLJZYCZryUwCxwwcKP/yLrqyMj br3/2F490oxn3uajE+gL7typJcGhBppWnaQEr633QUmMg7EwER6YQuD3RGufJyE6fBlj 1aDw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="QQR+NJ/p"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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 q14-20020a170902eb8e00b00194ab28325fsor7444817plg.168.2023.01.23.04.24.34 for (Google Transport Security); Mon, 23 Jan 2023 04:24: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:902:8602:b0:189:e55d:ec72 with SMTP id f2-20020a170902860200b00189e55dec72mr22405412plo.20.1674476674144; Mon, 23 Jan 2023 04:24:34 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id w10-20020a170902e88a00b001960806728asm1291811plg.88.2023.01.23.04.24.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 04:24:33 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [PATCH v11 08/18] drm: exynos: dsi: Handle proper host initialization Date: Mon, 23 Jan 2023 17:53:09 +0530 Message-Id: <20230123122319.261341-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123122319.261341-1-jagan@amarulasolutions.com> References: <20230123122319.261341-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="QQR+NJ/p"; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=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: , From: Marek Szyprowski Host transfer() in the DSI master will invoke only when the DSI commands are sent from DSI devices like DSI Panel or DSI bridges and this host the transfer wouldn't invoke for I2C-based-DSI bridge drivers. Handling DSI host initialization in transfer calls misses the controller setup for I2C configured DSI bridges. This patch updates the DSI host initialization by calling host to init from bridge pre_enable as the bridge pre_enable API is invoked by core as it is common across all classes of DSI device drivers. The host init during pre_enable is conditional and not invoked for Exynos as existing downstream drm panels and bridges in Exynos are expecting the host initialization during DSI transfer. Reviewed-by: Frieder Schrempf Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v11: - collect RB from Frieder Changes for v10: - update the to simple logic to handle all platforms Changs for v9 - v8: - none Changes for v2: - check initialized state in samsung_dsim_init Changes for v1: - keep DSI init in host transfer drivers/gpu/drm/exynos/exynos_drm_dsi.c | 27 +++++++++++++++++++------ 1 file changed, 21 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 902bd46964cb..d4a976d86f08 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -254,6 +254,9 @@ struct exynos_dsi_transfer { #define DSIM_STATE_CMD_LPM BIT(2) #define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +#define exynos_dsi_hw_is_exynos(hw) \ + ((hw) >= DSIM_TYPE_EXYNOS3250 && (hw) <= DSIM_TYPE_EXYNOS5433) + enum exynos_dsi_type { DSIM_TYPE_EXYNOS3250, DSIM_TYPE_EXYNOS4210, @@ -1343,6 +1346,9 @@ static int exynos_dsi_init(struct exynos_dsi *dsi) { const struct exynos_dsi_driver_data *driver_data = dsi->driver_data; + if (dsi->state & DSIM_STATE_INITIALIZED) + return 0; + exynos_dsi_reset(dsi); exynos_dsi_enable_irq(dsi); @@ -1355,6 +1361,8 @@ static int exynos_dsi_init(struct exynos_dsi *dsi) exynos_dsi_set_phy_ctrl(dsi); exynos_dsi_init_link(dsi); + dsi->state |= DSIM_STATE_INITIALIZED; + return 0; } @@ -1410,6 +1418,16 @@ static void exynos_dsi_atomic_pre_enable(struct drm_bridge *bridge, } dsi->state |= DSIM_STATE_ENABLED; + + /* + * For Exynos-DSIM the downstream bridge, or panel are expecting + * the host initialization during DSI transfer. + */ + if (!exynos_dsi_hw_is_exynos(dsi->plat_data->hw_type)) { + ret = exynos_dsi_init(dsi); + if (ret) + return; + } } static void exynos_dsi_atomic_enable(struct drm_bridge *bridge, @@ -1556,12 +1574,9 @@ static ssize_t exynos_dsi_host_transfer(struct mipi_dsi_host *host, if (!(dsi->state & DSIM_STATE_ENABLED)) return -EINVAL; - if (!(dsi->state & DSIM_STATE_INITIALIZED)) { - ret = exynos_dsi_init(dsi); - if (ret) - return ret; - dsi->state |= DSIM_STATE_INITIALIZED; - } + ret = exynos_dsi_init(dsi); + if (ret) + return ret; ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0)