From patchwork Wed Mar 8 16:39:43 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2786 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f197.google.com (mail-pg1-f197.google.com [209.85.215.197]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id F1E95414B5 for ; Wed, 8 Mar 2023 17:40:55 +0100 (CET) Received: by mail-pg1-f197.google.com with SMTP id y1-20020a631801000000b00503696ca95dsf4015098pgl.1 for ; Wed, 08 Mar 2023 08:40:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1678293654; cv=pass; d=google.com; s=arc-20160816; b=gAQlx5V9pnqJlEmaaoZmNigBUb9fafNxG5ATeyzf9R5jP90RTryQNETokEyHeMGPii qFH4oQeIIJD4MgqiLNbh6oUc9Fs76/wG93Arbvyv30qSWLnVRK4p06F8YnwyHXZNVNIf dwQ6y8xTlh1HlsANUcpwVQaOdxALEY/hiaGHIPI4i5QLr29jv/NkLFAAmSQzKntRLor1 1boa5SldOvzceb1G8vCiPbD/PMDvoXQgtHxntu7UIHjZi21QbZTjd3gFGqnvaKUCizF5 LMNsFLJeHixHqgCPx9MOssTZM5k9m0eK1Sei1JeMI+/JVwvToNwNZct156rNpAH0qZqg RuoA== 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=spQPQPBt4UjX5mrX4vKCwqJNPcszIfK86qhrpYbhjao=; b=lzLzG5/eRBY65dOPI+jGzFJJFMUydFKVWexU9bYFcVQ0PHedItIPrjy4RIY9BueDGc kQjWMe1h/ERcdSfCb8PpIs+qB8gF/m0o7hkrcjWN0F6vc1k56LPjisnHzfJgjsE5CT9b WHJ1VhAh1fD1zK3P7Z+Woj2aMMC8eicu2/N31MuIo9COKQn40G9p7AmZa5Kbcrq/wWj1 s+re5bXkA7mQ5lGLi+88Q3KoXrNPTAzUK4dD0EavduHxxlOZlFuUt/JsANPfVVFkeF6r /sUUZKwCcsrc18wflyvM0uPUIOqRpkv4/PV/rkpQl7c4x8LSMVK4IjCxOWuat2DaVsU1 6rHQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JkACBPEA; 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; t=1678293654; 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=spQPQPBt4UjX5mrX4vKCwqJNPcszIfK86qhrpYbhjao=; b=WvZ3w0RObJzy0zJc5H+nd4AhojGRKzFw/Ag56rYnDlM64RMqBVoFsO8WMNyI9CD+RC B4lIwsGmUwsTPL6cP6C/KrQX/XJYAt2BFeWnutWuFpUiFcPkQKaSy50nhTPmqTGkrqHc M08b1PRgZTphVRepeX0Q+zid2vidN1UvwjMK8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1678293654; 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=spQPQPBt4UjX5mrX4vKCwqJNPcszIfK86qhrpYbhjao=; b=L5S/jPgmQqdQRXsDF0LnWBsuOpNVSVs/V3P8fGre6KZox7Rrw4pjyRGTg1obCPHmWw pVlENvdaFuAiM8mo/cZ3pAU34HOGFIm0gGA+IJE995IZFHeWaPKH3x1fK1cqSucljFxI N0NlGI1pe58u4qRI1ozzHh/VARtBnYvJ7m6/20hn0AWAFN7WC/HKu+ZGPCD9rS31jKC2 lxjTTw0oio7cNc5T7Cue+aEqan7m+ioIDKYTmAscWc6D+I6MlIIUhARQfe4DGsdfYXOH iGZ51dSefGy0oXJq0NHLEf797vTUzIsBv/eOnBzhc1bEjUGmMIqKh+sL/8/UMauBeB13 xUNg== X-Gm-Message-State: AO0yUKWEgLChb0kIaaEdkQPBqgfXkuQD5349TuQXFsVUcoy2zmNGTNlr nkpJhXtL7ljttFFlO3PtvCbvrZCU X-Google-Smtp-Source: AK7set/VCgNZ2dqbXb5rKVnIbT6tt2USJMCb9ToDoWONOhNb1m1/g6zQi10sE/neaRolOwi+oqIYnQ== X-Received: by 2002:a17:903:280f:b0:19e:f660:81ee with SMTP id kp15-20020a170903280f00b0019ef66081eemr1158656plb.2.1678293654708; Wed, 08 Mar 2023 08:40:54 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:cec6:b0:19c:b3c9:49d5 with SMTP id d6-20020a170902cec600b0019cb3c949d5ls16356206plg.6.-pod-prod-gmail; Wed, 08 Mar 2023 08:40:54 -0800 (PST) X-Received: by 2002:a17:903:260a:b0:19e:6bd5:7ab6 with SMTP id jd10-20020a170903260a00b0019e6bd57ab6mr16515786plb.14.1678293653861; Wed, 08 Mar 2023 08:40:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1678293653; cv=none; d=google.com; s=arc-20160816; b=gcA0fuRxuaIFlu3sDoc8GJNJotvp/px6LNmNhuAO7wz8ZRyrluWlhBfXUv3o51SFRc m1g9I5f6KWxvQzQRJ//MwXmK/0m7ZNgZzJ+jemQn9WverQRnRYl4kVVhfp2ygb+VI0Tj rpoLllO6DyZsWTUUN+h67rvRuY5OgEPSLGCxK93+Fd4fleeDKvxbvIwIDYUpE3KiIUXi DcTwfW3nb2e4u8xSS8l8KXQjmf5zrP+GczQwXpJead1OWO1lei4B9DziLDC9N9T693Ln nR3IKphsmBTtqnJZd3IGqiTkRNXc0qa2GbVmg7MGOQ7RJmBZS5htalx2E2exQHoryPVN AfjA== 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=aMsPp2VhhzL5Iehbwf/OplfTAN7PVsKpf6p+LnZMlVY=; b=Gl+Uw32lXA0ihI7z+4GHVSt/pp0KyV4F1/+gLrePEiHJeqg2SoOR405nCtVTSinh/n BedLlMU35IfvhGsG4nOdvLpvCmpeNgBqnVo3V5SWOsmios/+ExM57izT6Y3mF8YNF5rf hG3fWmd1Cr5ZiS9cPoRjMWjhs8GUnJTPMHmIWethlXeOQ7wVeXNCRSoUTZEQ1sQwXSUX IV1VP1y1UrRUcS1MygwcuYpXGRof9r8biUUdRE4e3DQ2LSb6OSydrvV0UBrIYkhnwdSe WQbKcMrkjoxTJbONnz1qcx0xw+qIMMYPmcSENQ4fifqqxSioRFztiL/NnwnQyAPrqLyj agsA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JkACBPEA; 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 v16-20020a170902e8d000b0019c94b26500sor4874531plg.129.2023.03.08.08.40.53 for (Google Transport Security); Wed, 08 Mar 2023 08:40: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:903:25c2:b0:19c:b7da:a880 with SMTP id jc2-20020a17090325c200b0019cb7daa880mr17234523plb.11.1678293653524; Wed, 08 Mar 2023 08:40:53 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a8a1:b545:91cc:80b2:f9fe]) by smtp.gmail.com with ESMTPSA id kq3-20020a170903284300b0019b9a075f1fsm10046540plb.80.2023.03.08.08.40.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 08 Mar 2023 08:40:52 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v16 06/16] drm: exynos: dsi: Handle proper host initialization Date: Wed, 8 Mar 2023 22:09:43 +0530 Message-Id: <20230308163953.28506-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230308163953.28506-1-jagan@amarulasolutions.com> References: <20230308163953.28506-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=JkACBPEA; 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 v16, v15, v13: - none 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 0f0834ebbdf3..eb33c2bcac16 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, @@ -1601,12 +1619,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)