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: 12924259 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 8C1C5C43334 for ; Wed, 20 Jul 2022 15:55:08 +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=GJvZp8QctiYGO3AFnPem6CI+uzkVhF916BpUvH4kOCg=; b=TShaX8S09YLvCI XA3fTrboczSd90VOwyNq8aMJAYKJLhRIrpIqzU4U/8pWs229bJhZcG3eYKJrWR74yhhFa8rBiShNY WC2Q3WeiotD9uTX/JwEXDxyzdL6nP+Ub8iipxqjD7ZWnYoReMh6CW6VUxgolVt5yZxMAAUXJDF2I+ Ovs5VY/Hv315Yg9OuVyFE1vHIy+uI9uTifZZ2UCC4ZPUTNYzX1VxvlUco48bCdjjlFFO6zu+02mxq 8M93IZhhnQFU/ujiMzPCYfLsBhfdA3H8IT0Hcx03MW6WAPwByo2CF3a5w743c1Qa7BKl4ovVeQndx 9BTa0WVzmuDY9faZG7zA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEC1U-007pBb-1a; Wed, 20 Jul 2022 15:54:04 +0000 Received: from mail-pj1-x102d.google.com ([2607:f8b0:4864:20::102d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oEC0f-007oYZ-B6 for linux-arm-kernel@lists.infradead.org; Wed, 20 Jul 2022 15:53:14 +0000 Received: by mail-pj1-x102d.google.com with SMTP id gn24so3773918pjb.3 for ; Wed, 20 Jul 2022 08:53:13 -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=WZjdCys1wARNaHGqSCSF1WaRxrhPvglBL2HzzeN8DBY=; b=f9BPhYSsRKAu5C5CWgSOnopXYAxlWSFoYzx3Z/Sboktz59ZhlB20+IjyUmLgJnP4Ie 1obZII1hQGecpTgT+o7l3kc5qdK0WyzyOx9zitLfkIiNrZDHzY20nE6+Qj8HrK3UXGgL ZnUeuLDqbTjPxzclypHTYbGT/Pmx1tJOjhznI= 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=WZjdCys1wARNaHGqSCSF1WaRxrhPvglBL2HzzeN8DBY=; b=1hGBfJ4kACUg1hTdTdU819zCFoAbtBtX2Gv5QWCMPW8JOZgmgeJ7AXNFAWCwX93gTr FAj9uPy/EBiLxVgC/sY0v23ogPgmnZtqrTAsYaytprMkkstOzNP4bzdwOzthxfDvDqMJ WTgW2Jr9evcSYAD9tG0FzedsCVXQt3vTf8JwfyOfxpoqWSk9EiEkLSa+jGoKFdjL32rW AdwgtPuO9r46SxdbBZCj7MLUukIILnR4eP+mu7wbmpJCzAvz9Hfbttj8RHtbNmMudsQB xYx8g8IubWK7+l67r6rk8O18v6t5DYFv+b3eZ/wpmrPsBnM2b6f9nxzDyBBVeRviCAao 8Mvg== X-Gm-Message-State: AJIora82oBMncrSzsshPehhP0Hxk7HnsuyI6UIGOJJHmFpWKPTmqTuQV +0W4vmbZoPHF9p6oK4lkQ0X3Ng== X-Google-Smtp-Source: AGRyM1uJVjan2ZkGWRXvL7eayCwSTD8uXDMJM2c548Wbuu2YYcfaD3HTSqO7wvCrQjAkfjxWvjKjoQ== 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-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220720_085313_433752_0FFF2A02 X-CRM114-Status: GOOD ( 16.10 ) 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. 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)