From patchwork Mon Feb 27 11:39:15 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2748 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 63FA93F9C2 for ; Mon, 27 Feb 2023 12:40:35 +0100 (CET) Received: by mail-pf1-f198.google.com with SMTP id s20-20020a056a00179400b005c4d1dedc1fsf3296861pfg.11 for ; Mon, 27 Feb 2023 03:40:35 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677498034; cv=pass; d=google.com; s=arc-20160816; b=tpCvWvel47Y7ykvfI+Av8T9BPpBf2J4/NsAT8XJXXqZdx0CHfTBI6PeKze9Y4RYKVD hpUXQdY1bRdPgGV1SN+VAU0YSTUPhQO+DDve4inj4xD4cb6dqkg+QIdxDQOfHllkUqQL GynP+vvPdbfJtwuu6lPtISP+pN9Ob36xih3WDCz2sisDcwagCIo4cJLEk0NjHiIceo/b LQFmrUnI+9grmDVO91gPaZrYYHVMDvuitSE5x02wInbQmGmw4nr/9tJTJqUJ/dYQqFmP O1XMPMczzBKOIPaZCt7pKXMMfX/m1IvRQ4TGBWFTBRYMNUhVU59yXj5TsUmqi5bnqapZ 3MwA== 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=FpWDFsilpVibidJeWRGaj6zRJON9aPUs784QrnHRfZM=; b=wEGrEe/q89fMb/16M9dqP6qrsdFK8Tbby2Jl/v5BTZkD799+t7SwMFosa1RogQQnoy X1r5a0B2PctiBkisQZvAqBxXI35Rwd76Ts6gbEWx/bk4wV6QJG3R0J+T1GmxSuzzy9Wb g+oojqGNVSzPdcYB7y8dK65bhqkzspBZInHS5a09Gi5CbJs5vM6/jjQlrXhh+7/gz0jK WXAFaGjhXT5oeBQJ+cR3Lk54gIAaYoLfZgVUBgGFkkpGGEhCxbA3hL5Pz/nl/7iZi5FD 7AvqD1XlWJaqy59h3bum+u6iO6ItoJOaDvMVdK9kojMyhGFPVlerBLD6ZNA/BRe/3viK UKGQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oMN7np5Y; 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=FpWDFsilpVibidJeWRGaj6zRJON9aPUs784QrnHRfZM=; b=QVUNFntD5x6Yv75AjOAJ1COv0sdv6Ac64Z4ibFTiuaW+tPIemUJ3GwScxy2OEb7Sfc IO6b8DrKK3bpLp6LVaM8fnc++9JB2zFumQHUEJByOcIcYGSbHdclfrfLnRc2Hoo8XUP+ IHta8FtCuFBfkdf+A3pAHIIpE6/y3GtZuIjuo= 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=FpWDFsilpVibidJeWRGaj6zRJON9aPUs784QrnHRfZM=; b=IOfEF507WlFvF8yp077VQ+hF8K1Ov5XCK0EVOAL0aeT2bJ0iI2fiCVd9LRH88HSwBE 0Lu9q9tpgBlNHzpK3MTPZoz8PP5YnDF1034qdpzsEbj6MBEzJlsKXr/jC/cPv0SgKhW9 AuV76owBHETq3VL89lVwvaHJRguIhfJEEh5vOsAeBjRqLEvm8RhX41tfq2i2wUyVlkiW 6iA5hpxmq3yrAQWRfQm19YgR9/P4oWJgGafMQ/Mn2oxEp6E5j5vZKJ1aty2o08R2tqyR M1SmsztHwnLssDGS8H7svQhR81BU7kK4htBHhVhEAycYVQTUlulHW9nan08dxhtuoJq2 OukQ== X-Gm-Message-State: AO0yUKVknFQnQdkSGVxrBnBdFaay8GM3qOlVp+dQdHGL91BdHuyqpqxy 8EBDhWbIBrGG/iVI1EbbwKby3VWj X-Google-Smtp-Source: AK7set/YBiNUlfFBejbJkM+Rzq1Rv0F3y4fJzBOAnQ4CEITMuEwHJR4qNPR+I8LOwPSeiYphZnBDig== X-Received: by 2002:a17:902:f7ca:b0:19a:f80f:9619 with SMTP id h10-20020a170902f7ca00b0019af80f9619mr5893315plw.3.1677498034147; Mon, 27 Feb 2023 03:40:34 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:d50d:b0:199:50f5:6729 with SMTP id b13-20020a170902d50d00b0019950f56729ls10425855plg.11.-pod-prod-gmail; Mon, 27 Feb 2023 03:40:33 -0800 (PST) X-Received: by 2002:a17:903:2345:b0:196:3feb:1f1e with SMTP id c5-20020a170903234500b001963feb1f1emr29944879plh.47.1677498033256; Mon, 27 Feb 2023 03:40:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677498033; cv=none; d=google.com; s=arc-20160816; b=rBF4jmw1YjIKbLlnvn3eY3VGipeUGsBoTARZMW+W6TmNGDagLO4tE73MGhcO7khmmQ dqkEWsgpwMNzp8tWUexEkLAa0jj6Wk7Yif7/qdYmBUkqsMYDSCS+/HX/KSLYbpG7bAA8 uPx4+oV3eqGHwnEBceb6eB2ODgUer5eUkFefuUKE+05J7/hYYd+KOb8xhOmBI2szx/bJ uNSDxI4ImBRHmnF0tb5pNDmk/SbWK802XBlnrmeDT3G8tJ4KBKv16V2T8KLAxjOqmuf4 xtK+8g+XbVI7iG+NG7j8q6iZlhIBUtfi8uXApPdxGcPG4XJecJV0QoMQGNMc6uYijDvD djxQ== 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=aXzlQcM2+q3cNKX9yDd3QRgxQ4bSUjE8wzTk4MHaeas=; b=A88TJi5l0gwnnoOVf/K6CbnFQ8ttmHZzbEQ7NBGSxGNssynBrh7a/67egCAxU/5eCR k+zOAj0Cq54aNnIhcrqX1ZSs0ajZzwbjAQ8eTOsYX1164LOqPNu4jeUwWm40MpowtIoo ILYF/THniHY/AihSkqPaQYlXBMvkfO9V0t26YF14NkJ+/UDJqmIACyBOfcLXy8orpK1K XVhBxT6yYSUCTlmahHKav16J1+GRCDCmGRwNlKCULXdBMZy+kl8y2MWPBsMdwcKQn5o9 XdI/N+khB1CIXw+HazgR/Q9pinMUDRR4b+CvGH16nv6GnRa9x+pyr+DYpExMZC4Yjp/q tU2Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=oMN7np5Y; 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 d4-20020a170903230400b0019634c4979bsor2136894plh.146.2023.02.27.03.40.33 for (Google Transport Security); Mon, 27 Feb 2023 03:40:33 -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:c946:b0:19d:74c:78e5 with SMTP id i6-20020a170902c94600b0019d074c78e5mr5079561pla.50.1677498032954; Mon, 27 Feb 2023 03:40:32 -0800 (PST) Received: from localhost.localdomain ([94.140.8.120]) by smtp.gmail.com with ESMTPSA id k10-20020a170902ba8a00b0019c919bccf8sm4395277pls.86.2023.02.27.03.40.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 03:40:32 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , 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 v13 08/18] drm: exynos: dsi: Handle proper host initialization Date: Mon, 27 Feb 2023 17:09:15 +0530 Message-Id: <20230227113925.875425-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227113925.875425-1-jagan@amarulasolutions.com> References: <20230227113925.875425-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=oMN7np5Y; 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 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 9217b362224a..5723d91ff686 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -255,6 +255,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, @@ -1568,12 +1586,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)