From patchwork Thu Jan 26 14:44:17 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2681 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 1857D3F046 for ; Thu, 26 Jan 2023 15:46:19 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id u6-20020a170903124600b00188cd4769bcsf1203747plh.0 for ; Thu, 26 Jan 2023 06:46:19 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674744378; cv=pass; d=google.com; s=arc-20160816; b=UfGvBfMCCdlsMnhsvgJNRGWMvD8MQ6M4XdeIw63nNXSmMcXuTYDfAYEHXWeyos+BjL MtfCuNjlbo8Ns8w6b2szYIxTtxv/3KfTplb61ODDK0f9ot2q8XoZPenJSLyVFIn8cf/V PGvUfSHbsvMiaZ48jQsQBhEu1ab4CCCsu1A9o0oagIEziAbHHgpF4c5ruNJKlBq8l/aw Wu6VUdDT4jOKrKFN5p8wSSPLQqXo7jP2S6T2fZch13Ghj0hNTXjJuqVRnDR5LHme4Chd A9jsgrCKw4GU+Z9CdrAkbDCVirQ37C9MQIIqg6hV6UptUJGZIHre8knguWcsdfh9Zi+z 78zQ== 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=s7w17IKXyxGWZbiOYba/zsMLlZbi5rlNwnHJJO9/GrM=; b=jtL+3pW7MRVC2QBkJCo6O28kuCtU1KCGAaPAFTk36jyiPjz+9/b79YvGA/eHjfoOR9 GWM793Ad0oWaixcIAKFUaWaxp7rsS736M2au16NfmgSEohkKzB5PF0QtjKaRqiPUzGhu 5cDzUsxxc8onVr1KNJQiKzNHpFQ+P454Lu8r+UIBl9tW85MksZEo6Mwe8C6dCUW5PVLd ZUkbiyNugeIt4lItuNqBifTPzOk8SRMbrEXPnM7hO7phKhdUMIv1GgGeIRJRNFjHQnQD EjWERp/efJNp3wnsl8BCNBNgdN9KDXUtlunvJqJN0Id0kvbpqInra1Vf8aWyO7Vzmw3B d5Xw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="dh6luB/q"; 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=s7w17IKXyxGWZbiOYba/zsMLlZbi5rlNwnHJJO9/GrM=; b=c04CGPmkVdcrIZ9jgjvSI3jnqsVjXfd8721l9KUJkMv2UYDWo5Cj9+i7aVIWO1io4N wBdhW93IgNjzPtm9Jd0wzChORBCEvves63eb3YnH0dTIRf+6faY1yAJ9BaQnvJY7BjHZ 4mI+q9Cidu1sttNhdz9G/ylQm1PzcmFH7xpm4= 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=s7w17IKXyxGWZbiOYba/zsMLlZbi5rlNwnHJJO9/GrM=; b=LHYNgzKiwYGNxFLFc99GM88206g86YG6vKplhORwCuD64G+2zuQnY8G3PDZkcAJXoX akwDpaj2ulTc+BEJDrS82XdnxmD0KH1YN9KRb2np++mOdZxpwO1lMDWAojIfR5akL5Nc DlJcdNgpoL4IwpKsvcmz9KVreeqF+WQKLBMKgNW0XC8rVW5UOeVktNco/Ke8jXp2cifM eUhupzYcjrzQAg/oVVBYzWBrxjLDjUQxBu/uiL4GuzoNeEk3B5YB+1wWOaDpMdOCG4nY Up2VppVVPqjI4E4ifTVISzGaZIlrgnYABsoJgutDk9fEnvaVrYCawG5f20n+6ANrE4YP 83rg== X-Gm-Message-State: AFqh2kpOFL8S82ClobQrIKDbXMGK+UN3qjT6P2Hh30PhbYYp/7w8bcby 2Wt4XxO5FCwNPfbUv8IShdOqAHAC X-Google-Smtp-Source: AMrXdXsEuZj3X243sykQP858h9LLkF1xafYya+hKk6FjQlfFqxHWJNnaRsBmHZiCewZ8/hogF+TgVQ== X-Received: by 2002:a17:90a:7d14:b0:229:efae:388e with SMTP id g20-20020a17090a7d1400b00229efae388emr4503192pjl.46.1674744377910; Thu, 26 Jan 2023 06:46:17 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:4101:b0:22b:b65d:b10d with SMTP id u1-20020a17090a410100b0022bb65db10dls2682757pjf.0.-pod-control-gmail; Thu, 26 Jan 2023 06:46:17 -0800 (PST) X-Received: by 2002:a17:902:c401:b0:194:dc73:5cf8 with SMTP id k1-20020a170902c40100b00194dc735cf8mr36528358plk.39.1674744376874; Thu, 26 Jan 2023 06:46:16 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674744376; cv=none; d=google.com; s=arc-20160816; b=zCxXQQXVeK+USKiw0yz7iC8iLGynEEQtntfzX4qC2yuFaXl053ji54Q57i9k0Jvx+b 3P4xGFi0lDKcocZV8gqK2QWfzyHHNoUsuvGgAGyCud5c/+Ymm7QbmAk+U3CRvv1kGwCT ur+fh8cGm5b83oZPah+yngTFMAMF4Vmw/8jevkcBYmVOcjzo3cewt1Wsv2GoCvZTxevr iap+GeJlGIsszXTelwkjepyjqbgo251ruHYtv6hOr8RSFn+gI+y+cP4Mx0C+b3R8vFwl Xx6YdAJOhVEzP+DBeGNdgrpHBZX5I5Muf8BjO4lq3lBk7usHX0BGtpdNlD9GGKNKuy+L NvQQ== 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=aUy6DNNvAiPX9eeWAOGTVXrnTQlr6Vuyr0HCYZSKb9Q=; b=fn3VIi58Tc5jIaVvgqG7lYbX90tdWjbbgaXGHPL3/UM1s0tmQDXLaDOiKzulrpMkO0 RmVKPX+qkUeNlNKJyJAE24wMmN2X/63WKNlAR4yLEoNkPpOX4A9ni9ar1gKV6Kk95Mlr Y5jakUtyzYIWSY0xe8Z4RiknROIN/Tfs+ibTvsKPLgG641Osfqs46kszfc3TytAIct1L U5bYcCuN8EcXP0aa1LqeIYeKGN64PkfJbPIGSndrVenmliOfb5lRC8tJMWCqG476dSUz NwSZDshk/lSHaX8aVhF8ryZCnqBVLHBMK33pv5+8ktUHXGI9Glwx0YwRLp5lkHp+fR7M jSbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b="dh6luB/q"; 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 g10-20020a1709026b4a00b001924e53acfasor680769plt.159.2023.01.26.06.46.16 for (Google Transport Security); Thu, 26 Jan 2023 06:46:16 -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:a05:6a20:a89c:b0:bb:b945:4865 with SMTP id ca28-20020a056a20a89c00b000bbb9454865mr6751320pzb.8.1674744376555; Thu, 26 Jan 2023 06:46:16 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a238:3cb1:2156:ef87:8af5]) by smtp.gmail.com with ESMTPSA id d197-20020a6336ce000000b0042988a04bfdsm823660pga.9.2023.01.26.06.46.07 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 26 Jan 2023 06:46:15 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Robert Foss , Laurent Pinchart , 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 v12 08/18] drm: exynos: dsi: Handle proper host initialization Date: Thu, 26 Jan 2023 20:14:17 +0530 Message-Id: <20230126144427.607098-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230126144427.607098-1-jagan@amarulasolutions.com> References: <20230126144427.607098-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="dh6luB/q"; 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: Marek Vasut Reviewed-by: Frieder Schrempf Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- Changes for v12: - collect RB from Marek 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)