From patchwork Wed Jul 20 15:52:03 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2193 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id C790B3F03E for ; Wed, 20 Jul 2022 17:53:16 +0200 (CEST) Received: by mail-pl1-f200.google.com with SMTP id h21-20020a170902f7d500b0016ce3d68c3fsf7213667plw.23 for ; Wed, 20 Jul 2022 08:53:16 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658332395; cv=pass; d=google.com; s=arc-20160816; b=ITxcxTBcGK0hNjTgp2p7xjQ4FbdTNxG8aifxZPXi/QCyZpGe9Eh5C9J5Kn6SV8mWMS KGaqqwAaQFXzu6lTwb96jgjlJNpRMTP48ZLznaII4YtMyjoFluoRfSBz2aRD+fw+Ol1F J0tqh/cxXbIJtuXuwwi+kPeR+f8GBL5IKsXjrt7aOI6JEWgI/Gb0R4jUvYC6+uReyYQS yDyu9X3ef4lMA3meEEmg+4H0hQ1rKEw7jKFXDbE+ssEmAF52sPsMdD/aT2On6jps0l4v NvJQw5fjrmcx3tmu9r+sAkc4DEuxBIYZikVSv3+4bpsHEDI9UbMVSi7BePGxKTgYJkVv zR/Q== 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=kDrS1lHwrIsyFZHIO7IhzOoVy6V+T2LzbGlukwRtH1k=; b=E6jMJxow0FT1ShUU4z3iwi/ekRv0yPyi6qswfxoOKmQXLXPEiMoTpHTY4ucMw1ArhU aAH/CUgPfaOQ2UDaRfdZFP7s+AB3sUQaUukrJYO2m69dMETB2vOx606XL8O9+N6/+sAG q4h4p912B6/Jat/hunX/PqRDppJaMUzVMCBQxCzw7ssumiOApyAu/pKEeaun4M/R1Ng9 23KTZsFBahFTkPfm5Gr+kcSOPdpZUX8CeURI1WAX7RyjjHRkAY+CHPqZ1T5IBPRoZgpO v/ch5y0qv1UStLWUxqbDI7XlB1+SANWioc3NJbUq9+8lPe9TKv5GhaNF1+gaQptlXNt/ 7NnA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f9BPhYSs; 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=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=kDrS1lHwrIsyFZHIO7IhzOoVy6V+T2LzbGlukwRtH1k=; b=VM9eZEgtqxrUiR4waIfrrifIhWz9Y/BNHmcV+oA/9c4+k8CWmh3jIiBWaxovBH7tNM mPauqk7hgW/Jd/1oxsZqrHqdhzIgESJCPxQS8FfUqdMgBOmhZ7ZhaBZl/Q65n4UcZpbC zRCGjeRqbE6UJq0HHTRrLM6h0WM1b4i7CoLPI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=kDrS1lHwrIsyFZHIO7IhzOoVy6V+T2LzbGlukwRtH1k=; b=HzT+qa9y1qDxxSlha+X7RSItFFAb4nUN6a8OdwkMireWvw/yucD8xqa9mhPQZ5nx7A LaFo8yAsgF67RBtQP/ydGxOjkgXy2lkd17ePmxn5C7dFkFWPmm6rQ+QMge7fuqalikoV eCm0L6g6uvtVO6xT5PdHRShh6W+ej4/srLE5MMUwCDciWZAmc1VjbMJXcI2noVjDrUxu ETYZ3P3G8fJZlNGemkb55aBhEokKWpy1xuAnhkVeeJ3AVDeqJzLqrX095rms2Y67/mG+ NHyJyTnr1xY4HMDD91CILzuV2vdTwiCUmp3kJXi/MMTE5lWI8FxV6UR8L/cTaseHc1hV dEQg== X-Gm-Message-State: AJIora89cMeSh+NjCQk4lWiWlTlEozUr3Gu31SfaunIZQeIEsIMXhVaU Z6felmxxZ+RC9+8MJyjc/O2P63SJ X-Google-Smtp-Source: AGRyM1uPRIbC48CbItg7SOyjYa9HYtusI2/Ngpkw3aAUTrNtqOIahAqihm7g9uf2q9Zf6OKqIptBIg== X-Received: by 2002:a17:902:aa82:b0:16c:4bee:1f90 with SMTP id d2-20020a170902aa8200b0016c4bee1f90mr39911307plr.69.1658332395640; Wed, 20 Jul 2022 08:53:15 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:903:24a:b0:16c:887:8a4c with SMTP id j10-20020a170903024a00b0016c08878a4cls1625963plh.9.-pod-prod-gmail; Wed, 20 Jul 2022 08:53:15 -0700 (PDT) X-Received: by 2002:a17:90b:38ce:b0:1ef:c5bd:e2bd with SMTP id nn14-20020a17090b38ce00b001efc5bde2bdmr6350396pjb.149.1658332393118; Wed, 20 Jul 2022 08:53:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658332393; cv=none; d=google.com; s=arc-20160816; b=cM6FSUvDf/3bR6PYG4WVBrx4wcrEByuvNTkKtVLshdItsfMP9Y+MjBBKk4QCnmCmLf QpY5DiHE05UCIcuYEgAOt1gQOUxQR8riqjSLyCgZNClT/iyLVXpWl+kXBhnwCpOjcNUm hwcWDWAjwNC2YlxRcnnnVPv0yHA4mRar1oIEfIDfdzfKUcw0v9QIiAkzcgOuy4rWY7T+ s54MNn+/gbSvzCznjYG6vZCsJTuVuV80RuORtAk5TsHkZPPlRxLUo/sc3zxRWd8rOzzW 6/oTv6KAuYg8J+czmsRC7umWy25/QbWGrSit5hNwMlzyADrf9ZEOowIDC/xxRG/SjxVs xekg== 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=WZjdCys1wARNaHGqSCSF1WaRxrhPvglBL2HzzeN8DBY=; b=RUg1cjh52foiaKx7u/D3pKj8FUo2NZ2OaT0RSgjJr6F/lUINnCe1F5zelqiTZ+Lg/0 +A5+mUqPDnKnr5xNf3sHw2K6kUYA11C6H9uhxiznRYwb3njkfJvHei71uOo4Hu/ELgXq F8GDwoae8VgE0nDehIN+XLov5zeKECQ/b35viQpEgGhPhJeb9aUUkEtIht+eMzfLaWDv p4tIL51ijFhvYN5mRHugZS3NmXZeSoYptCKc+vpk0+UVs921Zib8gbDvn07SZEEM9cSl kSWYrOqeweWbEP86UmWkWtJsSWItkX3sy85e5T9GG9BuhRKiG9XSVQnf8dosjgWR5r5b 68Kw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=f9BPhYSs; 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 x13-20020a170902ec8d00b0016beba9c3f9sor7800383plg.106.2022.07.20.08.53.13 for (Google Transport Security); Wed, 20 Jul 2022 08:53:13 -0700 (PDT) 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:da8f:b0:16d:1c82:624b with SMTP id j15-20020a170902da8f00b0016d1c82624bmr5257608plx.163.1658332392789; Wed, 20 Jul 2022 08:53:12 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d177:d5:aee:4f03]) by smtp.gmail.com with ESMTPSA id a8-20020a170902710800b0015e8d4eb1d7sm13919198pll.33.2022.07.20.08.53.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:53:12 -0700 (PDT) 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 v3 06/13] drm: bridge: samsung-dsim: Add DSI init in bridge pre_enable() Date: Wed, 20 Jul 2022 21:22:03 +0530 Message-Id: <20220720155210.365977-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720155210.365977-1-jagan@amarulasolutions.com> References: <20220720155210.365977-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=f9BPhYSs; 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: , Host transfer() in DSI master will invoke only when the DSI commands are sent from DSI devices like DSI Panel or DSI bridges and this host 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 adds the DSI initialization from transfer to bridge pre_enable as the bridge pre_enable API is invoked by core as it is common across all classes of DSI device drivers. v3: * none v2: * check initialized state in samsung_dsim_init v1: * keep DSI init in host transfer Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 9b74a3f98a17..b07909a52f2d 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1258,6 +1258,9 @@ static int samsung_dsim_init(struct samsung_dsim *dsi) { const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; + if (dsi->state & DSIM_STATE_INITIALIZED) + return 0; + samsung_dsim_reset(dsi); samsung_dsim_enable_irq(dsi); @@ -1270,6 +1273,8 @@ static int samsung_dsim_init(struct samsung_dsim *dsi) samsung_dsim_set_phy_ctrl(dsi); samsung_dsim_init_link(dsi); + dsi->state |= DSIM_STATE_INITIALIZED; + return 0; } @@ -1289,6 +1294,10 @@ static void samsung_dsim_atomic_pre_enable(struct drm_bridge *bridge, } dsi->state |= DSIM_STATE_ENABLED; + + ret = samsung_dsim_init(dsi); + if (ret) + return; } static void samsung_dsim_atomic_enable(struct drm_bridge *bridge, @@ -1464,12 +1473,9 @@ static ssize_t samsung_dsim_host_transfer(struct mipi_dsi_host *host, if (!(dsi->state & DSIM_STATE_ENABLED)) return -EINVAL; - if (!(dsi->state & DSIM_STATE_INITIALIZED)) { - ret = samsung_dsim_init(dsi); - if (ret) - return ret; - dsi->state |= DSIM_STATE_INITIALIZED; - } + ret = samsung_dsim_init(dsi); + if (ret) + return ret; ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0)