From patchwork Fri Dec 9 15:23:34 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 13069884 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 91508C4332F for ; Fri, 9 Dec 2022 15:34:47 +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=+9mnykbfUxtBJO27aXxmFeiRgyPNBbSuoLmQbsFYJZY=; b=cNCUInpbPYgTCI a+h4kyp/FL+0ntVZfGORDfPo9s6kIz5cyGCF4D7mnWzxj9Pp4jEUz5WzftNIq4t8waLRDCZ9LsVp6 lmipQCTTrHnPWwv0CWaTxTVrgf8dAAqy3nAMeBLstFjRJ9acSRdJtr1Bl5PJC9/cBmO1WEc278k5e n0PBK83PiEGs6szUemM4x92Jv/iOfmAjBaCZeAVcFt3xbcrym18g/qfTSQm9Hyziid17pQb/nLUXI WILF0FspJcRf6ZGDEjQAClMhJmgN6SpLxARCO4+A3oW5Jz/TkOddOeQI32+CZSATavMenPXmwAmSg a4QtL/l6+H1PSSJBGPvg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3fNZ-0091JU-HJ; Fri, 09 Dec 2022 15:33:38 +0000 Received: from mail-pj1-x1031.google.com ([2607:f8b0:4864:20::1031]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1p3fHH-008yjX-T0 for linux-arm-kernel@lists.infradead.org; Fri, 09 Dec 2022 15:27:10 +0000 Received: by mail-pj1-x1031.google.com with SMTP id t17so5148595pjo.3 for ; Fri, 09 Dec 2022 07:27:05 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=D8mPqEQPN2em8iTEeAt5Sl90+CybIe48O5qmPtt0W8M=; b=XmeybZQm3pTPGYPcvjrGnRGTBkdUVOxBTsXvAOMWMkQQYxNdVwo6zPcoIDahOR0ZlG yqqRApqHHwoyxylzsm08kWfQybEcjDK7/Oj/ETS2GFORmd8IDGwqozEmTz8mRKqO11gN neLl4HdiTexT9aYZ+6Dm0SjpblU7xCEbWjVs8= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding: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=D8mPqEQPN2em8iTEeAt5Sl90+CybIe48O5qmPtt0W8M=; b=hO6OjBvDP9+r7x0Ori7F/qf3kjNpwQKF6bI4Go1Q0feF7nbG7knO7QmJfZNh4URzMB PfQCRM+/ZPSrS2Bw2YTO57GXzl9i1UobK76IGn9Fhm50kVPrEMaQBc6U8q0S3z9+dloR xv9MwxnRT667dFJCR0zP/kBz/KT8i5vWu5usx2YcmqRf6LHLeNluABckEu4PM3H4x0kc D8PV4wBw1lFLHn14NqnvDhRctNhvIfMAI+wViCLocDdT2kmfgJYNO6VhFMqkW8DLNd4V oV8ng4EPoyGG1Sk2i/pbK3ldX0fETc64AdXSqjDCrsGps+4gkjGeNIu4vlneFf/Vz016 5kEQ== X-Gm-Message-State: ANoB5pmbx6cDN4fip/b8TyognhL+nTT9YIYIrxAgd1GtBJ4qWWgvK/K9 k5XgwCtkmpWOp41yV8jklJ0syw== X-Google-Smtp-Source: AA0mqf76JqBQs9d553vjd8kdTr5hxdTfGn7UBuUCvJ9UY3SyZ6glN8E/72q9iSEsQt37yAV6zCDUug== X-Received: by 2002:a17:902:8c8d:b0:187:262a:7955 with SMTP id t13-20020a1709028c8d00b00187262a7955mr5610383plo.9.1670599625243; Fri, 09 Dec 2022 07:27:05 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:6ba1:bbda:c542:ba0b]) by smtp.gmail.com with ESMTPSA id x14-20020a170902ec8e00b00188c5f0f9e9sm1477587plg.199.2022.12.09.07.26.37 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 09 Dec 2022 07:27:04 -0800 (PST) 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 v9 09/18] drm: bridge: samsung-dsim: Add host init in pre_enable Date: Fri, 9 Dec 2022 20:53:34 +0530 Message-Id: <20221209152343.180139-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221209152343.180139-1-jagan@amarulasolutions.com> References: <20221209152343.180139-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221209_072707_987639_30A40ABA X-CRM114-Status: GOOD ( 15.38 ) 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. v9: * added the patch again 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 | 20 +++++++++++++------- 1 file changed, 13 insertions(+), 7 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 9adab5d372cc..2e15d753fdd0 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1250,10 +1250,13 @@ static void samsung_dsim_disable_irq(struct samsung_dsim *dsi) disable_irq(dsi->irq); } -static int samsung_dsim_init(struct samsung_dsim *dsi) +static int samsung_dsim_init(struct samsung_dsim *dsi, unsigned int flag) { const struct samsung_dsim_driver_data *driver_data = dsi->driver_data; + if (dsi->state & flag) + return 0; + samsung_dsim_reset(dsi); samsung_dsim_enable_irq(dsi); @@ -1266,6 +1269,8 @@ static int samsung_dsim_init(struct samsung_dsim *dsi) samsung_dsim_set_phy_ctrl(dsi); samsung_dsim_init_link(dsi); + dsi->state |= flag; + return 0; } @@ -1285,6 +1290,10 @@ static void samsung_dsim_atomic_pre_enable(struct drm_bridge *bridge, } dsi->state |= DSIM_STATE_ENABLED; + + ret = samsung_dsim_init(dsi, DSIM_STATE_INITIALIZED); + if (ret) + return; } static void samsung_dsim_atomic_enable(struct drm_bridge *bridge, @@ -1458,12 +1467,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, DSIM_STATE_INITIALIZED); + if (ret) + return ret; ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0)