From patchwork Mon Jan 23 15:12:02 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2662 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f198.google.com (mail-pl1-f198.google.com [209.85.214.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 0E08A3F039 for ; Mon, 23 Jan 2023 16:13:30 +0100 (CET) Received: by mail-pl1-f198.google.com with SMTP id u2-20020a17090341c200b00192bc565119sf7340618ple.16 for ; Mon, 23 Jan 2023 07:13:29 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1674486808; cv=pass; d=google.com; s=arc-20160816; b=W05FT4crGN/2cFwNV6swZleQ6oVo2gnShmWghmLavufjd1bQdT5CALbbTDNLIQ/1UP oXPmI2izG1firOc46or2n3E4/pKR1SFq2330qhK/RG60wwOzJSplAzZ0xVaVk3D7b79Z EsEw1WGG1wYqGWvAD39FUh9Mjuva7bq7PIchF+OfWclYK2HqA7pR02SDDoNTpOmWgdeC DNFChzef2qJgpE0q1JoDpL78ifPxLMiOH2U6ZTy77qS/HNvhv4k34/m+4Qs8urUrIdfn wwHULzxq8g2RkZna6auGFuBZ3mVlVgkUNmA/GlaT2c2u0KcJQDlDl4z83wTBFmM7Vx75 ipUQ== 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=A4CTY4YeIw+FrAK9VrAMjYxW3wMNNcQpcOyj+9m1+XHGc6bYl8Esg9vT1rEsiKEa6D 4v4HcBQpi5KSSlpiH5P4IUcXGFoMJZcGzRlFAQFkmPiKF4655/gc3vSRHXj7Y/tEzVrv Kj9vfNtJAtTfodoikXb1NM8o9dJOr4UZktKiDBBiqPz+NCTimBAc19UDl3c2yybjW85Y id91UnPzfirRC66aSsr/Q/rPgkhqDwoz2AouIfRH8wRBj3ot5xdoYgENO2tzJ81dELqh Fu8HHAy4FXop69fLsaTgHCI3gXmWrSI0p2iJ3VerflgcB5ZfFmIqzQchkCQROOpnwxU/ jZzg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GTAGiMWT; 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=ffJjSjWxxphIRaAUs+Cy5c+f9HEbIg04vCFrzc1Wr5Q1XTkwo+P93Ou6lOl8jzvI2H nv1bu8E7lItHDSVh21o61pRA2N8DjAC/+zNVVtXIBvBjQbtKAOOQkvmvVDlvqfSyMFAy qXpQQ4imYq/0XY95miE88S594fVFipFlkez8Q= 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=40t0Pw1JAu3Vbrijip3kMVmsXClnPQoh1wo6wBlMAfHS4EdtZdQBGcLUtHgp2J1HKN kFCB6YK+EwLaLeQQTvQnTDgRaDBxbRMVDguvvBXbh4Vnt7I0xlvfpfGGxymIi1AiDIzk ykuyo0LPWzLjlmjEXRwicpbURSzvq7zL8n31yvHKSGRvL6WOx9xfcReEGEFFHqWEDAf+ v0yGzRkU4iahVXupVC0IZLrs8hYnF+tFsQZfH294jfXsCjQRcphXfwT3S/VPILrDf/7D /b6t0rOqTmM7aLQYWczEHPs9C0D0jgmX5jl+7+Gj/zgWvDg28s0scFwij7jT/KcmNBiJ q5Ig== X-Gm-Message-State: AO0yUKUcxCXbHowXqboGzKsnDWXRIjRiROLAT/YdKgrqwvm7tUF4geRY fHbMGTT7Ohw+p7rGetnXl0w+roxm X-Google-Smtp-Source: AK7set9+ScMOziHW6sqVYFtmVxj2b9lUJyxlNMzM50BdyeVGuCDDFHXrPv3VbWQpJ8f9JqLbtp0HxQ== X-Received: by 2002:a17:90a:2ce1:b0:22b:e36a:6ca1 with SMTP id n88-20020a17090a2ce100b0022be36a6ca1mr68012pjd.55.1674486808817; Mon, 23 Jan 2023 07:13:28 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:d507:b0:22b:b830:313 with SMTP id t7-20020a17090ad50700b0022bb8300313ls8530064pju.3.-pod-control-gmail; Mon, 23 Jan 2023 07:13:28 -0800 (PST) X-Received: by 2002:a17:902:b711:b0:185:50e4:f59c with SMTP id d17-20020a170902b71100b0018550e4f59cmr22411656pls.8.1674486808038; Mon, 23 Jan 2023 07:13:28 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1674486808; cv=none; d=google.com; s=arc-20160816; b=GIFCExNX89gr9bAN9WQTw56nV8KCEOS3e5liHb5Dge70+5RxN35hLBHvIAIM2o6Tmt zVkr0CES4wqp5dxv+BbbgQOQlD32URiXCLIoatl9hmqJwhXo+ozEAKQhM9ZZJnQs+gQ1 k21zo5D33JFsxC1dst+kB8vzQDZtTItHu8LHqO189kMu8oAZpb2wahyifbwtxqkn1XLB RPTmn5knzORjDY6T90+O7HN0FBgl8FtCfY04gkQx3tutpJFOwAFy/6OJsWejmkJxL+Zk YZLkcrgQLSg5OipP7YKyEbLZXlM4HhSjcZewcRyJVOMSMStL8LMqUVWK+4arF9o15kr0 OwcQ== 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=MehhlvYjMoPDqWUSUONX5neAiuIfnlbF67TdflKbDz2LryQ8lUzY/d+mM6oG4TwMwR 9nibs7S0dg29aiZxRfcYwclb8Lorx1h9LzYJVNX6zzrviP4ZlswzwWbAW+lHxOOKCG6/ 264UfpzJmI0wOeBIAKCn3MG0+x0ocJ0jEfLC+bnRqyaPRoYpdsLYZRgWCyGzSap4mCiQ rZkXMlQ5arW/pIx9nP+QnRbEfMDRdpKIb+i6hOQ7vFNBINfffZRJqYdspVO3pW55PW1k DL/mCeoG+n1YREkbSpFd3FR8W8cwoRdwBONNWEgOWsIPcsRU5AQpRiTlM1tEzN9SI8Jj Bg3g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=GTAGiMWT; 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 x4-20020a1709027c0400b001896a603e17sor2096889pll.44.2023.01.23.07.13.28 for (Google Transport Security); Mon, 23 Jan 2023 07:13:28 -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:11c7:b0:194:58c7:ab79 with SMTP id q7-20020a17090311c700b0019458c7ab79mr32632612plh.63.1674486807702; Mon, 23 Jan 2023 07:13:27 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a15f:2279:f361:f93b:7971]) by smtp.gmail.com with ESMTPSA id d5-20020a170903230500b001754fa42065sm19207111plh.143.2023.01.23.07.13.20 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Jan 2023 07:13: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: [RESEND PATCH v11 08/18] drm: exynos: dsi: Handle proper host initialization Date: Mon, 23 Jan 2023 20:42:02 +0530 Message-Id: <20230123151212.269082-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230123151212.269082-1-jagan@amarulasolutions.com> References: <20230123151212.269082-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=GTAGiMWT; 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 Reviewed-by: Marek Vasut --- 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)