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: 12837722 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 4AC9EC433F5 for ; Wed, 4 May 2022 11:42:48 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=WQI+3lNt3mNwHC+W6smaFKuUbHYNq5aQKNuE5i8leBM=; b=Qdg5s21U5kWzJ+ VxrDlPWjH1+OS0OMywhbOJMo/RqUudeo5EIqdUqpPzjZ2cAkuOU9ye468mVKBheGA2EstVXqxqNhY X/Pif7cCKM3M2c4XDuEZdSIdu54IpLxQL0NVkcmIzXRzf0Hg/wUKEyWAb/vg/6zyjhdqbeCDhRFhR 9MB2mcOE2c+mbkqiZGUj8V6LhT4kahw7xULZUAwwrRpUWI/RDO9ISUrEf5mAEDWPbTN25HXmM1tdO pjlTVJEaBfgxVjunVt90IsYWjvguuBcKhyAbwphuT4lTLcTL71zk1iFJhuD+hOUrtAEobMUVVluA9 4NxQbDxpkWSLdYryWCgQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmDO5-00AVDy-DL; Wed, 04 May 2022 11:41:45 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1nmDNh-00AV23-8T for linux-arm-kernel@lists.infradead.org; Wed, 04 May 2022 11:41:22 +0000 Received: by mail-pj1-x102a.google.com with SMTP id w5-20020a17090aaf8500b001d74c754128so4973767pjq.0 for ; Wed, 04 May 2022 04:41:18 -0700 (PDT) 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:content-transfer-encoding; bh=zMs/ahjsuW/3pyoDPdTDx4JCwHHuvSLOtpCm4rKmrXg=; b=SVenTxQUkDyXsYbLphK8C8joex+YA17/52S2UEEQuasymHntl+gbZ6hBKGfef+rU9L BJgX/jpUAMw69v1x0Y+63HYOLAcQLEh8CeBdOZ2dDhfF9Aw/h08RNOdyD2yeDKkBh4QW i0nyfkpjGQYgLcHFOBKBcpeZ9N1J3/6o4DqJc= 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:content-transfer-encoding; bh=zMs/ahjsuW/3pyoDPdTDx4JCwHHuvSLOtpCm4rKmrXg=; b=BrK0eg+6GpEaJgSx5p14CnzNgK0ui0WARszP2OTVUoo30H/RALWmdLOvxgdTVtpdY1 VSBX2Bp8TdW19dt+sC3mJLlqkEBGAyg70EDsVlABv0z4yk2Ebz0gGhiM6FtWvyDIDHaP tZ+A87DHiJYpxOiJMIGFmrCsxY1tTrhRUu67R7aXELf0+AAFIsFWmXW41n4k1R0RzM2H E6VONdrn1IJVSA4QpqpZXUNUBVLZW3cRX3XDFfkTSMk1o69FF1wigCBhtiIOC3UYkj7k QE5zxHgWrr5wi6H//kdXGbwR6UVOdfTl+GRxp954mwu/wlxELTMGijvcpxMB91flMcA4 T1ag== X-Gm-Message-State: AOAM532Wylgc2eVwQLCOo+QmD3pdyoMElvwHnDHOn5qPjqQlBM1CbSTd Z8OFC6f4nUsRrNS/2+X5TB2/LA== X-Google-Smtp-Source: ABdhPJxD8WMIBN5LbEmrgwis2/7My6i2oV6asbmrzISHufiZynRA61sNuZBJnYMXJamBVxlNiks0ew== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220504_044121_333040_4570CC3E X-CRM114-Status: GOOD ( 16.21 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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)