From patchwork Fri Mar 3 14:51:28 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2769 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4C49E44AA6 for ; Fri, 3 Mar 2023 15:52:48 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id bw25-20020a056a00409900b005a9d0e66a7asf1462824pfb.5 for ; Fri, 03 Mar 2023 06:52:48 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677855168; cv=pass; d=google.com; s=arc-20160816; b=bAQEoS+c5bwNnArnCsU2pWgGdqAycg9LdahiWEtSa9lTp0CvjpdM9vBZtd+TieSlMt zw7vgX6dHREdeYv5R3csM2Z2Ya4F39nXW3uikE7NtTKnx/w1aLkYk6GHWVsju1y7bIOv 7ADNxoE8BvD/PI1bzwPeiR5IX0d982zk6mCy79hwJNsL0V/KrjQUIyPEoH2dF8jws5NW aewSzdnpiORYdEfiFGklEvSvGhPgXlBYBs7onz5syZAV+3kjx9eb5C3J9E+eRG/JPuHM yI638mf0YHCsMD+I4LWJX8GBaVizD86bJql+uLIiOL4OaK5DS6BVZ42ntLsLPsgrhKea tZtg== 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=nhqySQxwnU37o42Wo8WUmTicyP1TwbevskFrLsm+eVs=; b=zw8rb7KblL3kM0mh/eg7HXAoZ/dLLzCRYy+F4ZG9dYJeBe7yPTU4OHs0wAIh+b5oc/ TY4zNDsQ1QGC44qxVl4z11DE7F0ymg25rdPIqagGiXeRk/GelNPb7P7bjDr6eRkIGjZ+ xgphLVA6NYQXl0u4EKWB7dvtYD0d939IIAklM1TL2UsNCXoQCXgnEMCb1zNAD2G2LW/N wbFjjEaxy0XEz412rsxMSV2lwkytqb3LDW6TmC8G1ipvMzegMiLNMhMym+6fBy3jpAMX f6rm5lTaWgzmDuGlrK90EpoC91p9a0Gab2V7a2WWlBbWraPFLo/heZzZZ9U7ee070qwK rjsw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rUZCHWJH; 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=1677855168; 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=nhqySQxwnU37o42Wo8WUmTicyP1TwbevskFrLsm+eVs=; b=Bvbsu+KY2f/Gyjx2/8u0pCZmyl3Mess+qVLL3xMOCByO1x+lbgwfKEtFIwYEUHpbiL KeiU2WngG5pYc3Gf4kXy9GkFqERLq/dBBV3t1XcYLk3cZJaS/3KK7ycYHF+d8TKjplb9 FZcrrjmaAPF/DS1O0DCyUVXcV4i7OJSXEKXRs= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677855168; 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=nhqySQxwnU37o42Wo8WUmTicyP1TwbevskFrLsm+eVs=; b=K8NWA4kIhwkfniC8bp9wwO0/pxXds55t9SN6L1b1mh6+Ib8AaN2okPkLGEU9hSxMgB WPx16ThHFevmYYuBjGKgCCflhDg5U7zUBFejAkcWtq1pFO6HVILwh+Mu+5PMgGuo+DMk MkP59C3ciwYq9Zm6+aQgLCRUvZdRUt8QEMx2zeJt8ztGtg7L175UPDgtUS2aa6a/bAuN ZQ5IZCnGupk/Hcpu5gTO45N25mikNNVYOUp8Y5qVh0IX16+rvnJdR5ABIvwscRuck5ll k3qn56BQWFBKAqZ9AbtE8DcbPExHYhYERIZvQANwyLSbQsYYGmWMnqAg2s0b3w26boIm 7rHg== X-Gm-Message-State: AO0yUKX6YxL5T12qobqEB+mUMZxdo2tPGxnA/aoWxF2/xOVDzom1K3x6 a3hYSlc5Y7sSq5Y21hpujnOzSre0 X-Google-Smtp-Source: AK7set+aVom6nAHzxf07M3vIKn8A/X1dkt/+sufRxZTo0ZpgSFoXeo5udQUCuXbxT+y62wby0LAsBQ== X-Received: by 2002:a63:7512:0:b0:503:77c6:2ca3 with SMTP id q18-20020a637512000000b0050377c62ca3mr576460pgc.5.1677855167901; Fri, 03 Mar 2023 06:52:47 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:cec6:b0:19c:b3c9:49d5 with SMTP id d6-20020a170902cec600b0019cb3c949d5ls3186188plg.6.-pod-prod-gmail; Fri, 03 Mar 2023 06:52:47 -0800 (PST) X-Received: by 2002:a17:902:cec6:b0:19d:1bc8:488a with SMTP id d6-20020a170902cec600b0019d1bc8488amr2669671plg.29.1677855166936; Fri, 03 Mar 2023 06:52:46 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677855166; cv=none; d=google.com; s=arc-20160816; b=aI+UMDBUMjGQwOa8u/rzUgSJS6NJb8BbzTgKaT14HCwpywsG0SEXTPsUiSs7uH4g10 6ocXRYZdizMo3CQi65wBrX5IlcGNTLX8lKUWHvmIc0QixIm73uKBN3Iy7srPwLAlcPYZ 5W5DRyOHWpIp7CX2FR/KE1slnqtUXIMtbwhs9ZXQ6DAYnKDjYVgFMUwN1p5HyheR/wLg 7zqnyAcB+JzFehyPaG12T72O/zQ5itYQcB0KKVMeeXVGZ8i//K8dxytSt6sStF/bB7ZT L5dlp/O7OrYs0/0NYo/MlHvCyl6wzPxgIXvZzcBc+++byWN/E3hmgoGha8Du1N40bIJn FyOg== 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=6M6pIqw7k0M+vm8dE+QD7gZWyxxkXhmbFOQyY/9HzRQ=; b=wPCIMdcsizKQZK7X00lJLu3Fs2XgHnQ27I/6gf0A9EdwSXprmfF3DSWDbZWRr2tRtJ nLwyDYevzhIcCL311pcNaGcbhzVdYo8Qw7Y5KXdcrCfjZGwyJ8SBmHn1HeTtj2LIHafd WceAVPzVhWoahvYvUxNpBwYg2cQrFzNXLlV132SYnyVweWlI4wjpTJqPIGLhQRhYlDaH 4ZVgP1/20ftqY38rHj+5TdsR9haKfSSUEgYz9Kh2BWyoLYVeYp7wh/1e+oeI2rE4r+TP IY+r5OaZRrUt5RZ18eB/4IMvO3wzvHkbPpN/EVZRxJupMgiIqxdJEqdDVri5Rzwqmy5O +fLA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=rUZCHWJH; 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 p9-20020a170902780900b00194768d4461sor1090894pll.148.2023.03.03.06.52.46 for (Google Transport Security); Fri, 03 Mar 2023 06:52:46 -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:12cd:b0:cd:40b4:bc75 with SMTP id v13-20020a056a2012cd00b000cd40b4bc75mr2845320pzg.48.1677855166602; Fri, 03 Mar 2023 06:52:46 -0800 (PST) Received: from localhost.localdomain ([183.83.137.89]) by smtp.gmail.com with ESMTPSA id z4-20020a63e544000000b00502fd70b0bdsm1660856pgj.52.2023.03.03.06.52.41 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:52:45 -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 v15 06/16] drm: exynos: dsi: Handle proper host initialization Date: Fri, 3 Mar 2023 20:21:28 +0530 Message-Id: <20230303145138.29233-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303145138.29233-1-jagan@amarulasolutions.com> References: <20230303145138.29233-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=rUZCHWJH; 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 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 64cf69995750..fe195d76ce76 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)