From patchwork Wed May 4 11:40:14 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1934 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 5D9223F067 for ; Wed, 4 May 2022 13:41:20 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id v8-20020a170902b7c800b0015e927ee201sf602751plz.12 for ; Wed, 04 May 2022 04:41:20 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651664479; cv=pass; d=google.com; s=arc-20160816; b=fmU21PicT+HVWvfPODocHeLzUKw53C3o7lfAM5FuwQJf98k5l8cUJ+NdzM8Qaw2h0h NXOGYbOVzD2DvO6QCZ2HuRnPhax3rA+oHYohAJLtpTKnPxkfZ7IIGjvACp3CndVdrUQw A1h/D+FnJ3AgikZL5MwuD+kZ76pmcMCzZbZ9g9SyohA6o4sxCoos3XNxn8VSaggKfa6z CMArUmQGKRrH3Q/40mE6C4Ff1RgFFu7ffVovwLrmEOrK2oORx0UWDSpeXhME6jzW7jIf TZFmDqvN3VZEX8mwIDohkMGCD60aQIjDIbL3iGkIXLgblhytcg2nhV5U/ZARZB9lO+cn jcYQ== 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=5fxGU6wr0fHe4QcC8k3cD1yFCaLRL8Yt2b3+w9bTTFA=; b=Hxn+LP+ah7Sz8P0hwLj3uLD0bubWnaIgoK2ZSo9TsrZ6gyz07eiS/PPnFAg3Wcpthg IfKZEsAwjmD/pWsR8Oi7dvtqDdo2q8DRdbTqN+Y6Qh06L7yhq+gWbJyekbgv9SWGlPfN qruaY18HSp/UleNFAcQHusUreIIXwrd4XBSrvLy3t+4cXNqClQRZHU09HfYVSwjDKiim qDkQ1dnLTMc76V4CVGudFi+bpHk32EuvMw5OtdCaSrZd+XTo269WkTjRVqXqEn3q08d3 OHj7cLE8UR5L0eSP7iMSx0L9i4mO0r0yn9qAknPrmf7Q+3htdDLhlFj2rNfTnQSRe1GC EEOg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SVenTxQU; 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=5fxGU6wr0fHe4QcC8k3cD1yFCaLRL8Yt2b3+w9bTTFA=; b=d5DPju6YYPHglBHas89N/UFtUyoB6Chj9nDmAcQN/R11e27IbgPqD6Q8y62czp1BG6 XaqFwlXsJAeZnjipvYmpPgTKsPQrW6i64GT9aTxIACEFtCn3IMeaZxj1zI0iCEIMy7VB iYejKbf6dh3UORZe0fk+woiU11nswIiqi3nbI= 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=5fxGU6wr0fHe4QcC8k3cD1yFCaLRL8Yt2b3+w9bTTFA=; b=WqXOP0ENJgsO+3dG20Uhau0wI41iCKiw5/QNAUT0USVm9FqVfZwZ27NMfMSSey4IQ6 Jg97JfSCt5bnSp66Fbpu0qQS0UdFFzmq35+7zS6eoT1rCenVlVLycGf3/3f93F+prtst udjVvhtdDKbZeQgGPWuTa8yUumI0qOLMAPUU6jqH2IHqXZSYsEt9iqgKyePKCPjjDFlj 9UVKQ9Y/Shyc0sMjr1rFXWvYwEJninTAfrCVoXBpWa9lIU+hva0nrr1/eij1XvM8H1++ FtU5bOTmLFpmDGbURNSNKDdJjVdyxvNqcX41YPT0mb2gGaDMjCpU9WhMCFfvKzz69rrr eSZA== X-Gm-Message-State: AOAM530hjiwYC1HLHWbqaSWgZ+ju0fQBUxweq/tbEezt8OmTPI7jcb9+ r9mBlL/Eco+418mC7K03rmzwG9el X-Google-Smtp-Source: ABdhPJwX14cUAcIY5XeWkdam6qKZ9wj802IAUJQR8rNH1YGcdqKYgypcoZwmo6kJcZJVpz7nqoseXA== X-Received: by 2002:a63:6bc6:0:b0:39d:966d:2791 with SMTP id g189-20020a636bc6000000b0039d966d2791mr17459789pgc.407.1651664479049; Wed, 04 May 2022 04:41:19 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:1b07:b0:1dc:4ad9:71b4 with SMTP id nu7-20020a17090b1b0700b001dc4ad971b4ls3935793pjb.0.canary-gmail; Wed, 04 May 2022 04:41:18 -0700 (PDT) X-Received: by 2002:a17:90a:cc0a:b0:1dc:9a3a:6eef with SMTP id b10-20020a17090acc0a00b001dc9a3a6eefmr3256615pju.127.1651664478350; Wed, 04 May 2022 04:41:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651664478; cv=none; d=google.com; s=arc-20160816; b=T9yRXOQJSR7Pr5FmCro5ihw9tmcvedcgRTuuV4mB9pR6V8LERLKUAA7+aQl2Q3H+WV BpnRCGRbw8aIc2s5ehZHZVt18+Wu3v6TaEXpwS7YMqqAbQHbPysp9PKOH2ihDWLakoy9 lVPAqstnDhTFmnUWeplHzIV/sAPSp5N4aHpRlFMwqaLPeei1jTbyiGTVn8MmgMM50OjW A5eG4CF6vwCwL4njYjoqjkXzMPBd8uwlioZpOh2ynlXhX3N5f8YMav2Bpm6DbyWgCLqz kxNUFOHhY7x5X/cljuDlr2WefJ4NQ2hmJ+0uI2+6Ywh9FZ841RA4Ryu0a/aZhHPSnt9+ RzFg== 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=zMs/ahjsuW/3pyoDPdTDx4JCwHHuvSLOtpCm4rKmrXg=; b=s6eaf0rTWJa3PHMkaP2blZMvD3/Jv9yINpMim7Ar8qfKn2rVXFAKd6iLd3VRrmzBqK uYAc9Nqtr7bMCSjmPpH2udtn8yImXkyXidXqyMqZOK4PsvO2MfPXBjVytaeb0VFgCae6 XJ9UBw5SrUh4coniFVa/6G7Ne19nBGFg+LL0gLClQhYTXvN+owebmC+fsjWW+cfQVJs5 p5/cEDuVi7OVZU9UJUszG0ZLuPszFskKLRS+EH0IwjIzq/U/RdbEdvpcxB2fLj9031qm WuHOwg2MM5rKkWRt0XkssALUfLDoGVhYrvgBmCo8FTOYnY0hxYlf0M0w76eVtmTMy4Cn ZS9g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SVenTxQU; 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 9-20020a17090a0b8900b001dc9a7778a0sor640535pjr.30.2022.05.04.04.41.18 for (Google Transport Security); Wed, 04 May 2022 04:41:18 -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:90a:de87:b0:1d9:8264:baef with SMTP id n7-20020a17090ade8700b001d98264baefmr9889219pjv.227.1651664478075; Wed, 04 May 2022 04:41:18 -0700 (PDT) Received: from localhost.localdomain ([183.83.137.38]) by smtp.gmail.com with ESMTPSA id k15-20020aa790cf000000b0050dc7628174sm8027498pfk.78.2022.05.04.04.41.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 04 May 2022 04:41:17 -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 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 v2 05/12] drm: bridge: samsung-dsim: Add DSI init in bridge pre_enable() Date: Wed, 4 May 2022 17:10:14 +0530 Message-Id: <20220504114021.33265-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220504114021.33265-1-jagan@amarulasolutions.com> References: <20220504114021.33265-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=SVenTxQU; 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. 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 60dc863113a0..b9361af5ef2d 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1259,6 +1259,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); @@ -1271,6 +1274,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; } @@ -1290,6 +1295,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)