From patchwork Wed Dec 14 12:58:57 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2559 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 844F43F0FB for ; Wed, 14 Dec 2022 14:00:32 +0100 (CET) Received: by mail-pj1-f71.google.com with SMTP id nb2-20020a17090b35c200b00221433a393dsf3904157pjb.5 for ; Wed, 14 Dec 2022 05:00:32 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1671022831; cv=pass; d=google.com; s=arc-20160816; b=nUT4/78yKNKKMCsMt0RP/hZC/vIBfxmDirzsGIP7AFWLcrFR3SgSPi6vuWv252WmAV mR0zTN5VGq2LBzJMLeQUUdy++FS4jE0RxRWl5c+V1aJ+ZGJPx4sDLdFLf3kmZK8mXpQU Ye4D2CaT+gv2yfZZFg8wQ6+AT3jnBkBUKyfuxX4X3G0XUq24/IbVMsl1/PTrRBYDrX2c NdgBl305E/AGar8Q7AftkF7pyOWHSPNmqo2uT3nBneYqGAB9KXP33K9oj2NqZcrLpt5Z RWVF+COMLsMBNwjpRk1LpRsVUSrqz+ZJ85W/S1YXqLHkD7AbsdTIAKv98BUS8LY0+TfE HIrg== 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=/y2GhzBpH0VbzevuAcmU4sr+wKoREV4tfN/PBgPgyHs=; b=C/8Yr+ckh3U4LTBOkOAW6E5wbDYgmr0aZaMOhtZxNMjYYQahbsmXh+FnLuBZZVS5R2 dSEp8iz/8ofoQ/Dnm/2JWAzSQIjr6A+dGHNaAt/JDZ+ep0Fx7+mGIN7iCPmgoj3IGrTP 4vovGVGlXH+wOXnwd+lgqpQ3C5ERk//OLgHCNUhjTrjbtgl3l4zNUX2TWPhgSHKQcqkI YIaHPW+C2ftbS1J1t9i8+WUJrv3poqx4Zsm4qT8nid7CSy+YX8vFglSjGPA26Ybzxc25 zSF7wVe5Q2EVBc2PNyP/as7hstxUyNZY5gXDLqK7tVM8JQPfGMztkUzwyRLR7zoOGNF/ +7TQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HTPrpriN; 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=/y2GhzBpH0VbzevuAcmU4sr+wKoREV4tfN/PBgPgyHs=; b=W6F2K5OymgZQH/UIduzyL3flxpGHEBxZo9raNBmmdPFu/FpzQ/g1e1b4JgxBzZ/Pyj igJQycmUK8aCNlNiAfQXEk0retLJ2zn6XeWot9mS2E5HMygjm2Ihd5Hr5elZvRu7sc+y Jhm6aLFOvUNOpQlzcEXINR0rqABNjdsm3xmQc= 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=/y2GhzBpH0VbzevuAcmU4sr+wKoREV4tfN/PBgPgyHs=; b=g81ffp2P1CY000e2aZg0i9qY7UwtRQpGNp46JEBKo52EHIEbyBS+ZT/JZQDsbAHVbj dPEqqCVjxajgdmOzYeMSU96+xnSM3DpvtGnUBNKhOAU2mvYW/wm7RwCvk7VLXSx2irLo nY5vKhUTcgoDG5TKxeeTKlq3LT1quGoAUd7SLgpxKHR13FZNJvdoeNc/pc7XfhUDVw+l VBr+5nxUcln+eXeti0rX/kBJ/peTRfiPg8bf9fp356LORg+ZH2OttD44XZjLXqXIcCFY vLCdIeGzj+nbEgEfvmkq3MsW7YQy4xGLAUtQHGnXfervmvNQLdDRoth9Vy8yVh2rMoy7 RtMQ== X-Gm-Message-State: ANoB5plyqbcGq8PU42fuZJbEIM/OuA+ruPQwG3H6BNYHJj5qi7tfJ4/0 3wdHFQZUqrF/l+O/CDfi69670lUx X-Google-Smtp-Source: AA0mqf6SD1H10fCWZrYZrI+4mVMGgdxfZh4Kw8YLhTsFD1eti3lAETwfThyjhfZFXGgkEXXcIwLpLw== X-Received: by 2002:a63:cd52:0:b0:42a:9ba8:8c6b with SMTP id a18-20020a63cd52000000b0042a9ba88c6bmr88598713pgj.407.1671022830297; Wed, 14 Dec 2022 05:00:30 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:a898:b0:210:6f33:e22d with SMTP id h24-20020a17090aa89800b002106f33e22dls24225812pjq.2.-pod-control-gmail; Wed, 14 Dec 2022 05:00:29 -0800 (PST) X-Received: by 2002:a17:902:8c8d:b0:187:262a:7955 with SMTP id t13-20020a1709028c8d00b00187262a7955mr22769852plo.9.1671022829033; Wed, 14 Dec 2022 05:00:29 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1671022829; cv=none; d=google.com; s=arc-20160816; b=h/wftaIR9/ZSqKS14+Yc+kTO51ZSZlhzdj2FsJCgPmoIBH6FYWyoOjdFnpJSMhsqMs NFMeXU8trAeWHkYPZiwohqZdDDrP4OrRMFuEUuJKvBqSEnRwkV6H3Xj8VdA+E6O9FyLx brQ4/SXdSBJ4GtLnn255CAE2hQX+HqoSar+X244L+bwOlf2RPKRLx+09ZNUyjGSxMWGA yWZBMKRZqpnbTpzpMRCQzOe4NG0TfXiu345p/R1i0Z+jz8yBYQYUVR6cEflQvXOf+Cl3 AZA5Se28mT5qlVYViz3/nNuCXf6yxCz+R0neMhrVgZRqk6PlxqGJ80zdXbo+h2gBB10f o1gw== 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=reAzV85TkTxD1WK0rGG72gcOzphutndqWeG8pF/PWes=; b=uosj95w9/BRxIibvbUMCvtTyO6J86wUCXp3NYJdCzUO7QJ0o8j0uuM0T4vRrtNOjPK NNyHYqasI3A5+XvWVRLTNLu805i6uVTdrAxXKN301RlgKKGrPcBBaDrn1F9zZCe1Hn/4 MMfM0+k3YPEdyoM40yK8nzamiTC4A24dy1lM2eRJrzjSZrFh8XVy52JryV8M7nQzjx+c HmxH7IOXR9s/FV3FiPhdJBZdq1vXcR3bBBiKnpMSYIpCrInwjlTSusoieZXfeivXtza1 JQVjXYm9J1IbeIzEbYg8qehBQl7K1i8RXQyzDszxc/nGssLo9ezF5SDo+yWs3b3A7Pg5 MNXA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=HTPrpriN; 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 i5-20020a1709026ac500b001897548534bsor1582495plt.119.2022.12.14.05.00.28 for (Google Transport Security); Wed, 14 Dec 2022 05:00: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:3043:b0:189:bf92:ec8c with SMTP id u3-20020a170903304300b00189bf92ec8cmr22486241pla.7.1671022828579; Wed, 14 Dec 2022 05:00:28 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:5e03:faf:846e:352d]) by smtp.gmail.com with ESMTPSA id ix17-20020a170902f81100b001895f7c8a71sm1838651plb.97.2022.12.14.05.00.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 14 Dec 2022 05:00:27 -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 v10 08/18] drm: exynos: dsi: Handle proper host initialization Date: Wed, 14 Dec 2022 18:28:57 +0530 Message-Id: <20221214125907.376148-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221214125907.376148-1-jagan@amarulasolutions.com> References: <20221214125907.376148-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=HTPrpriN; 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. Signed-off-by: Jagan Teki Signed-off-by: Marek Szyprowski Reviewed-by: Frieder Schrempf --- 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 fdaf514b39f2..5792f9883cee 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, @@ -1344,6 +1347,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); @@ -1356,6 +1362,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; } @@ -1411,6 +1419,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, @@ -1557,12 +1575,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)