From patchwork Sat Oct 1 08:06:42 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996435 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 B2D80C433FE for ; Sat, 1 Oct 2022 08:08:46 +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=XiBKdc/GliZ15vlIT9FzrDqzJj5XkgaHTAmkiJzUBEk=; b=lSFmPjO3nNypya QCrhlEju/FtrAAYbBkzhYXaHF7P5U7okiscGfjXKy0M0XGaoIwtUjzfA8mdjF+S31hXJSeOdu4Qk/ NE3qmC8m29RiQgTse9/vlIHMVPmvGNiX64Ihy4aVbNFdKM+NO+e7BYIKSBIJ9+Yu7Ir1lLT6Q4uyj ZwW3k6QtE3r2um/Rru4OomkdGPrsNLv148VXIgcqxiubkJuClkkyOcOTVznx12V/8FcXNBz06kj4w YZXoDPw/u/WcA47iZ8rwNqlIodnnCZJI92dFV3kP17zJ3RTX2XXwR3WU5K8zrPi9p/G3Tz7j1uoOL CfBfIw2KLI4M180FaNbg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXN-00DetN-Bm; Sat, 01 Oct 2022 08:07:53 +0000 Received: from mail-pj1-x1035.google.com ([2607:f8b0:4864:20::1035]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXK-00Des6-4T for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:07:51 +0000 Received: by mail-pj1-x1035.google.com with SMTP id u92so6073351pjh.3 for ; Sat, 01 Oct 2022 01:07:49 -0700 (PDT) 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; bh=tVRN+SsBdMvLqk2xiEJ4U+qCZXLzKyUiTAK/FAHSFm8=; b=fvWn4rIBJQCtt6ZwVXmuLqGTY81bJtEKDrRXtI/bSOnj80wXc7vrV3Ty9/y42ImboE aC0X2Htr97s2ylchvP1hFOUFVyeMUc5pEtCOCQ4hHFZKiLueeWn4hCk23kxcOnAvScdv IqnT6ulAlG1hTDyLDC9wRKU0kkhWe9RopiGYE= 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; bh=tVRN+SsBdMvLqk2xiEJ4U+qCZXLzKyUiTAK/FAHSFm8=; b=YJ4pSgYNfetyBc6SDcUe58NSI+VrEdCA2wVM/0ivOC0cuGlCuhoZ/N0fAb2gxWATlO fHJvvt/ulEmRdSIpS/tvsLAqvGxeCwpy/SPLV9PNcjmZGQArBzxfqpsf3K55WN3VVsuK Bxd1jznql1kNfZ4e/GotYXLmCywMLLDrS4WwvZxCAvEoTgSzcvFc55FOJtTBvf0OMqZC qHb4m+JjwIMDMC4ZRqhioHK+N5sxLPc6TnLpcKHDQY1RoW/Xv7eN7yIwJxQXColboKlv pUEYTiA2h3tQgFy59o+GM/Lt96sil3u3/BJ8E8LubMcHRCwIhSNdGWwkfn2zc1FL/Tmd 8hOg== X-Gm-Message-State: ACrzQf228zKrzTCCahV3yxEwrgS+a++LwXR3rTk+4RcfFZP/O1WLSbZy tLSJ3DVOnmMfUo9j2c+UEx8arQ== X-Google-Smtp-Source: AMsMyM4pczOShl+2vY/8S7j0Y1ekSIr+nCwbK8dbU+DnE2EtOvzK2OuZDmvl7iXQ3yxa4siDhL5qZw== X-Received: by 2002:a17:902:db0a:b0:178:2636:b6de with SMTP id m10-20020a170902db0a00b001782636b6demr12925881plx.58.1664611668496; Sat, 01 Oct 2022 01:07:48 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.07.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:07:48 -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 v6 02/10] drm: bridge: samsung-dsim: Lookup OF-graph or Child node devices Date: Sat, 1 Oct 2022 13:36:42 +0530 Message-Id: <20221001080650.1007043-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010750_199990_8E57D0DA X-CRM114-Status: GOOD ( 18.94 ) 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 The child devices in MIPI DSI can be binding with OF-graph and also via child nodes. The OF-graph interface represents the child devices via remote and associated endpoint numbers like dsi { compatible = "fsl,imx8mm-mipi-dsim"; ports { port@0 { reg = <0>; dsi_in_lcdif: endpoint@0 { reg = <0>; remote-endpoint = <&lcdif_out_dsi>; }; }; port@1 { reg = <1>; dsi_out_bridge: endpoint { remote-endpoint = <&bridge_in_dsi>; }; }; }; The child node interface represents the child devices via conventional child nodes on given DSI parent like dsi { compatible = "samsung,exynos5433-mipi-dsi"; ports { port@0 { reg = <0>; dsi_to_mic: endpoint { remote-endpoint = <&mic_to_dsi>; }; }; }; panel@0 { reg = <0>; }; }; As Samsung DSIM bridge is common DSI IP across all Exynos DSI and NXP i.MX8M host controllers, this patch adds support to lookup the child devices whether its bindings on the associated host represent OF-graph or child node interfaces. v6, v5, v4, v3: * none v2: * new patch Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 38 +++++++++++++++++++++++++-- 1 file changed, 36 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 73dcd825c654..e41b6eeef622 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1356,18 +1356,52 @@ static int samsung_dsim_host_attach(struct mipi_dsi_host *host, struct samsung_dsim *dsi = host_to_dsi(host); const struct samsung_dsim_plat_data *pdata = dsi->plat_data; struct device *dev = dsi->dev; + struct device_node *np = dev->of_node; + struct device_node *remote; struct drm_panel *panel; int ret; - panel = of_drm_find_panel(device->dev.of_node); + /** + * Devices can also be child nodes when we also control that device + * through the upstream device (ie, MIPI-DCS for a MIPI-DSI device). + * + * Lookup for a child node of the given parent that isn't either port + * or ports. + */ + for_each_available_child_of_node(np, remote) { + if (of_node_name_eq(remote, "port") || + of_node_name_eq(remote, "ports")) + continue; + + goto of_find_panel_or_bridge; + } + + /* + * of_graph_get_remote_node() produces a noisy error message if port + * node isn't found and the absence of the port is a legit case here, + * so at first we silently check whether graph presents in the + * device-tree node. + */ + if (!of_graph_is_present(np)) + return -ENODEV; + + remote = of_graph_get_remote_node(np, 1, 0); + +of_find_panel_or_bridge: + if (!remote) + return -ENODEV; + + panel = of_drm_find_panel(remote); if (!IS_ERR(panel)) { dsi->out_bridge = devm_drm_panel_bridge_add(dev, panel); } else { - dsi->out_bridge = of_drm_find_bridge(device->dev.of_node); + dsi->out_bridge = of_drm_find_bridge(remote); if (!dsi->out_bridge) dsi->out_bridge = ERR_PTR(-EINVAL); } + of_node_put(remote); + if (IS_ERR(dsi->out_bridge)) { ret = PTR_ERR(dsi->out_bridge); DRM_DEV_ERROR(dev, "failed to find the bridge: %d\n", ret); From patchwork Sat Oct 1 08:06:43 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996436 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 6D47BC433FE for ; Sat, 1 Oct 2022 08:09:03 +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=uvnghoQTrjRkU1vE8HXNQarBgPzDJv+HEJ1tVT145BE=; b=u5OFNjc5f8z943 BA0YpN/HAlg6Yq/hpQFJx/StOgMvBFpaBsfOLQ5uJQnueXboRl2+TUFI1qHcKyY4kNFLGqj9Q85+t iBTRMyOHuQjOiLF8Ilyvgmr9GCHdjcleUu+EckywwnO8VIy2fcHgh6ayaqy5IHP+8I9jOCFbTAJHY CmbzhhlLb2JR27QGcEs1ZJOBRaAcM8VeJ9zXyLbijHEPCXQVxjSQBDvYsgURPiwdO9APRmBjNn5IU 8OmBl+g5/VhqUMMVQorl49piqtNZQfQ0CbXdNKGbYnH9AqHnVEZD3hWlD0IJ0ExVV+xIm1fkN80zk 4crxZo4qLwGCWn2PtFSg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXd-00Dewm-Kv; Sat, 01 Oct 2022 08:08:09 +0000 Received: from mail-pf1-x434.google.com ([2607:f8b0:4864:20::434]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXb-00Devs-0f for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:08:08 +0000 Received: by mail-pf1-x434.google.com with SMTP id d82so6102132pfd.10 for ; Sat, 01 Oct 2022 01:08:06 -0700 (PDT) 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; bh=8w8yLdkBYp8fmjlqiLKDKImnbgR9vL2oirXeCiK2yvo=; b=BfXJd+n+S4aNfwtACs6jSgrH6FcHo9roH6nQlbBDI7+IqxVouQrHJXancNUN1b54+r YDr8ZqHphVjCkUS5RJmRPzj0hssFDXTgXtTnegN3TpqRaMnvckayZgh0D7MMP3qjdOhu OWHwL6aZBV3rcdggYzE9hjTCrETE4S/mG6wUI= 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; bh=8w8yLdkBYp8fmjlqiLKDKImnbgR9vL2oirXeCiK2yvo=; b=RaJx7erf7/0TQsb117ABXwAt23AlUDmlzjzR+FHiewsJVqHqX4ZkuX0xbYIn0h+2ns YiE/jinkJ9PtHqcu7C7tfDY8FFNYDc/cd+Bnpr7hRd1otj0PV695FWHPQ0FMPH4C7pRg 5UkdGVlWVbPR0Q9JH+INaUi3TeAKKAphjKezdfeyxzIg15JontRB3Q1QBN5++1M7zTQv +X/nyoKK2pk2zlCRW729u7W+oGXk3S6vYbrZVzzRnJECwEH7yPH57eLpH6Q3RLmWF7i6 0qPmwqoE8Jtnl+3x9e3wzawDJ3q2e0/BzaCy+hn7armZQkLGmWfQBGAkzQFHLEFx1Uud 6JCA== X-Gm-Message-State: ACrzQf0njeLN5gtB0y+gEHsA+5OyFIpLgeoYeD0bIfqgc90tXk7Spgs8 qWwe+5f9+SYM+uzZkckauED9hA== X-Google-Smtp-Source: AMsMyM5PQLLtGy13dGbF1U4VNyG4/4E8lKF4ne0P7BIV9/byRtOgpVP28HPjl4VFw4GIs5LCh0HNsQ== X-Received: by 2002:a63:847:0:b0:439:22e4:8e49 with SMTP id 68-20020a630847000000b0043922e48e49mr10565092pgi.165.1664611685994; Sat, 01 Oct 2022 01:08:05 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.07.48 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:08:05 -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 v6 03/10] drm: bridge: samsung-dsim: Mark PHY as optional Date: Sat, 1 Oct 2022 13:36:43 +0530 Message-Id: <20221001080650.1007043-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010807_076612_0182179A X-CRM114-Status: GOOD ( 13.91 ) 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 In i.MX8M Mini/Nano SoC the DSI Phy requires a MIPI DPHY bit to reset in order to activate the PHY and that can be done via upstream i.MX8M blk-ctrl driver. So, mark the phy get as optional. v6, v5, v4, v3, v2: * none v1: * new patch Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index e41b6eeef622..2ba909ec5239 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1584,7 +1584,7 @@ int samsung_dsim_probe(struct platform_device *pdev) if (IS_ERR(dsi->reg_base)) return PTR_ERR(dsi->reg_base); - dsi->phy = devm_phy_get(dev, "dsim"); + dsi->phy = devm_phy_optional_get(dev, "dsim"); if (IS_ERR(dsi->phy)) { dev_info(dev, "failed to get dsim phy\n"); return PTR_ERR(dsi->phy); From patchwork Sat Oct 1 08:06:44 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996437 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 96CEDC433F5 for ; Sat, 1 Oct 2022 08:09:26 +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=HQF86K06i2kxcvqfq0U5/y7VD9YOTqxT7XdORKyqH9M=; b=bRp6gWp8ZNQQOi OwrHWyCn3FupK7tKaabQoH/r2kTUReRIdPmrnnrAQKjWziS1beqzoAJHJi6x7XkoUH5FZ0Deq5ztg tKW91FVZ+5MRCF/xPNAxhq4LxI9527aLFyLMozGKJGkQLqAhAx1EPu3CL4uYQr1igkcw3dVIBRWj3 iN9nybqPdBaTP8NjnodQ3+qzNeNP1bICgh1nza3I84uQ7p+/zWPMzEXqeEsT9rkIqL4UrMJKejsZc qOsZAQOI8a9Z5rxedsVnpWHLG+QDXRiERenNkWBO0trYfNpMSDg3jm53dU6843DX9jy/WCJ+1kwFK 00J70ZEAyEIqAp5YfbWg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXw-00Df2J-Sn; Sat, 01 Oct 2022 08:08:29 +0000 Received: from mail-pg1-x52e.google.com ([2607:f8b0:4864:20::52e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXXt-00Df0u-Fh for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:08:26 +0000 Received: by mail-pg1-x52e.google.com with SMTP id s206so5943735pgs.3 for ; Sat, 01 Oct 2022 01:08:25 -0700 (PDT) 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; bh=Ke/kHSIUtl4EAJQ/hjOQA71nefBPkPlcvo1GhHET9E8=; b=YE7cv58N9RW4OIyM4jXxEGd5pB/yhJBnKPT2iilRqtyLVs3ajOGpJbSnDdQNhcN0ha zw12nEDF52P8edMqEgBLo/lytT4aE2iqPNOPCF6k7Ut4BVbShI8ViLQj6uF0X6xTC/Nc rSUM6jL8/Uxa72RAohk4QcF8EDYOf0CWTpiRg= 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; bh=Ke/kHSIUtl4EAJQ/hjOQA71nefBPkPlcvo1GhHET9E8=; b=Whs2D3QoopdFDKZyK/SiArZUqrpr5HrVAlY4hwqbha0Dr2FhL2h9SknRvnFX+A5Nfr N9BKHqOzK2Ejelz+GnUnriorPxvSg+XGWnBtTDbK9oHDQmwkvqo8rhs4yab6SaBFQcTr k8KrXrWZzvnvMxWbzWgTgo2pc49cT+VQJGBNuNNo7E1gX6kwyRtP46kCEz40UOBSrLGc prSLgLRiS7M9ztUL5/RJGMg/7f45tgWMQp8EIQoBmc+QIpAGBio9eSkxcEMZ7nFs/ZCx hrTv/PN280OeWizvof6U04rbQth78pn3d61LvqYJ1Q8VprbreZral6IOXTdEGEuXmWgr 0/QA== X-Gm-Message-State: ACrzQf2fu0Kv7TrFezzOkrHmVriWjp/WkwhzFnZiYXkCXd8jjTP1FM6O s2qMc6V8AXm/Dsk0x7r1U7yb7A== X-Google-Smtp-Source: AMsMyM6JwRvi+Ewzv0hDAvXHAw9i9EWDyl03ectNydcJIUPmzlbehB8fAz+xeesUswLt08bzxqLnmg== X-Received: by 2002:a63:33cf:0:b0:439:f026:aab2 with SMTP id z198-20020a6333cf000000b00439f026aab2mr10713031pgz.86.1664611704758; Sat, 01 Oct 2022 01:08:24 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.08.06 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:08:24 -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 v6 04/10] drm: bridge: samsung-dsim: Handle proper DSI host initialization Date: Sat, 1 Oct 2022 13:36:44 +0530 Message-Id: <20221001080650.1007043-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010825_550871_2F9900C7 X-CRM114-Status: GOOD ( 18.42 ) 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 DSI host initialization handling in previous exynos dsi driver has some pitfalls. It initializes the host during host transfer() hook that is indeed not the desired call flow for I2C and any other DSI configured downstream bridges. Host transfer() is usually triggered for downstream DSI panels or bridges and I2C-configured-DSI bridges miss these host initialization as these downstream bridges use bridge operations hooks like pre_enable, and enable in order to initialize or set up the host. This patch is trying to handle the host init handler to satisfy all downstream panels and bridges. Added the DSIM_STATE_REINITIALIZED state flag to ensure that host init is also done on first cmd transfer, this helps existing DSI panels work on exynos platform (form Marek Szyprowski). v6, v5: * none v4: * update init handling to ensure host init done on first cmd transfer v3: * none v2: * check initialized state in samsung_dsim_init v1: * keep DSI init in host transfer Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 25 +++++++++++++++++-------- include/drm/bridge/samsung-dsim.h | 5 +++-- 2 files changed, 20 insertions(+), 10 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 2ba909ec5239..0636440e4420 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1234,12 +1234,17 @@ 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); + + if (!(dsi->state & DSIM_STATE_INITIALIZED)) + samsung_dsim_enable_irq(dsi); if (driver_data->reg_values[RESET_TYPE] == DSIM_FUNCRST) samsung_dsim_enable_lane(dsi, BIT(dsi->lanes) - 1); @@ -1250,6 +1255,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; } @@ -1269,6 +1276,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 +1469,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_REINITIALIZED); + if (ret) + return ret; ret = mipi_dsi_create_packet(&xfer.packet, msg); if (ret < 0) @@ -1653,6 +1661,7 @@ static int __maybe_unused samsung_dsim_suspend(struct device *dev) if (dsi->state & DSIM_STATE_INITIALIZED) { dsi->state &= ~DSIM_STATE_INITIALIZED; + dsi->state &= ~DSIM_STATE_REINITIALIZED; samsung_dsim_disable_clock(dsi); diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index b8132bf8e36f..0c5a905f3de7 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -17,8 +17,9 @@ struct samsung_dsim; #define DSIM_STATE_ENABLED BIT(0) #define DSIM_STATE_INITIALIZED BIT(1) -#define DSIM_STATE_CMD_LPM BIT(2) -#define DSIM_STATE_VIDOUT_AVAILABLE BIT(3) +#define DSIM_STATE_REINITIALIZED BIT(2) +#define DSIM_STATE_CMD_LPM BIT(3) +#define DSIM_STATE_VIDOUT_AVAILABLE BIT(4) enum samsung_dsim_type { SAMSUNG_DSIM_TYPE_EXYNOS3250, From patchwork Sat Oct 1 08:06:45 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996438 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 D58CEC433FE for ; Sat, 1 Oct 2022 08:09:45 +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=tJ+vZXOAID2LFAzGHVYSzV+gbmm2xn5Bu+DBYpIyH8g=; b=DR+oQPF+Oa3p1/ 3u0b34g0VMCn9jEkBBYg5EDkeS4OTzkDeu38eLXFxDCkhMCN8P5bEno657q3knYD9XEtycQ19tzmf E1kuuRftaC0AD1wQhBeIVKW0G3I1nSmwQNwFgXY9Q0BmouIsBM3yO3NxbhhPIKXBvFHXFvUmRqbHw s00F5t6TV0W7npP88EMrnjmYUGPR105CptL2fiu9x9PLGhjco8x8MBvRjvMmvs/VBsZnAL/c31ljn VFKpcq+BFRQsJCFrcTIeVaAQPSkBhMrHSCE2ZFfcLzXwSAK5qH8C/ZUXZAtIFbom0StH9A5DtPNiS CnZTzbmZbLNH0aNfz1zg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXYI-00DfB0-RV; Sat, 01 Oct 2022 08:08:51 +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 1oeXYC-00Df7l-FU for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:08:48 +0000 Received: by mail-pj1-x1031.google.com with SMTP id x32-20020a17090a38a300b00209dced49cfso3555651pjb.0 for ; Sat, 01 Oct 2022 01:08:43 -0700 (PDT) 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; bh=exCDkdGNSGOnQuwt75tA06xXIS/Hfqspfp6d4Hi7GrE=; b=eou1vIfwh6IratgErERpeV/fnv/vqpLNPXVuzy8iqNkg8l1kiHpxG9SiK5Z0bL3fjR p3NWEIk/A2A9kvUEVpJgqMhSceL/lkMFvmnSiF/fT2gFGC5Do0k3NkRsyRW756yeOwgK OolA6E6qITw9q3CnOmK9CSbq/kMYeKpS9Y7Ag= 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; bh=exCDkdGNSGOnQuwt75tA06xXIS/Hfqspfp6d4Hi7GrE=; b=z55iwUddvWdUHAqazHJWcg6fT86fGw7JjsmrGlJKdF8fXr8wqMdfeKdsVoXgDVyPQW +/IS5JzwMUgjWgVozOtzTVJ4Bq8LxJ9Jcep6Ko0YN+MMbEy3xv0LtCjAQCK21y+jcpvl lkB0oDaa0FlWtUdvplrpBf9QIBvIQN24HTPzhrY9bkUU7kxWkmqjhkbqOzwamkFwFVY8 oMT4uS2QdoCl2GhXt/w9CB2dtQT6iL6ZqSL99XLY537yQDlom5itCvsk3UOThsz6+gLE W/ZCMZ8DXJnlBjIzUStZa0Jk1Fv2OhxYsOhzxMfi4zzaUWGCcACLMWpHiWa4MuQUIBXI 2utQ== X-Gm-Message-State: ACrzQf2EaFdTAfl6vI28ig2VZV4dcN8T33pdJAzKtNo9i5hjX69jJSUH JyD/m/p3q9eekwmywZDhW71wug== X-Google-Smtp-Source: AMsMyM7jAth4LCJ/HHdFel4Qc6FGDHJ3waYERRYzDSdbb3siuFo6Pf9ChwiEcxracob6l4JePTLbvg== X-Received: by 2002:a17:903:2288:b0:179:eb73:b9f5 with SMTP id b8-20020a170903228800b00179eb73b9f5mr12795552plh.163.1664611723397; Sat, 01 Oct 2022 01:08:43 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.08.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:08:42 -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 v6 05/10] drm: bridge: samsung-dsim: Add atomic_check Date: Sat, 1 Oct 2022 13:36:45 +0530 Message-Id: <20221001080650.1007043-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010844_533945_73CDEB91 X-CRM114-Status: GOOD ( 15.78 ) 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 Look like an explicit fixing up of mode_flags is required for DSIM IP present in i.MX8M Mini/Nano SoCs. At least the LCDIF + DSIM needs active low sync polarities in order to correlate the correct sync flags of the surrounding components in the chain to make sure the whole pipeline can work properly. On the other hand the i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 says. "13.6.3.5.2 RGB interface Vsync, Hsync, and VDEN are active high signals." No clear evidence about whether it can be documentation issues or something, so added a comment FIXME for this and updated the active low sync polarities using SAMSUNG_DSIM_TYPE_IMX8MM hw_type. v6: * none v5: * rebase based new bridge changes [mszyprow] * remove DSIM_QUIRK_FIXUP_SYNC_POL * add hw_type check for sync polarities change. v4: * none v3: * add DSIM_QUIRK_FIXUP_SYNC_POL to handle mode_flasg fixup v2: * none v1: * fix mode flags in atomic_check instead of mode_fixup Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 26 ++++++++++++++++++++++++++ 1 file changed, 26 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 0636440e4420..90506be3f2dd 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1315,6 +1315,31 @@ static void samsung_dsim_atomic_post_disable(struct drm_bridge *bridge, pm_runtime_put_sync(dsi->dev); } +static int samsung_dsim_atomic_check(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state) +{ + struct samsung_dsim *dsi = bridge_to_dsi(bridge); + struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + + if (dsi->plat_data->hw_type & SAMSUNG_DSIM_TYPE_IMX8MM) { + /** + * FIXME: + * At least LCDIF + DSIM needs active low sync, + * but i.MX 8M Mini Applications Processor Reference Manual, + * Rev. 3, 11/2020 says + * + * 13.6.3.5.2 RGB interface + * Vsync, Hsync, and VDEN are active high signals. + */ + adjusted_mode->flags |= (DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); + adjusted_mode->flags &= ~(DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); + } + + return 0; +} + static void samsung_dsim_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -1353,6 +1378,7 @@ static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_check = samsung_dsim_atomic_check, .atomic_pre_enable = samsung_dsim_atomic_pre_enable, .atomic_enable = samsung_dsim_atomic_enable, .atomic_disable = samsung_dsim_atomic_disable, From patchwork Sat Oct 1 08:06:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996439 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 62FD8C433F5 for ; Sat, 1 Oct 2022 08:10:02 +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=Y/LVnxz8ESfMzM47RC1A+ozlULCRCODRbox2PdQx8Hs=; b=CQFo3l72ywuQiY 8sTvpq0oAMaRHQTPAbcR5wFKFyIh5YKvnoYAqdYjMDNNO9zqIslxZJ+Pt4KsFIuYWQGIzWStbumdR gNCqHhxKCPR92RGkg7zCaS/iy+PhfNfoM+YiWGVdT0WMsg7Hfc9mKzAoT81PEPhp2ayN8vHK32nqi HQiE7xERkm6AIDLli+B8IayiXSIvwOBYLJGn7JDL8uLcKLWmciFN4M5fi62bEtOFwnAIX08/tk14I LKeyEvydkhhoLeK+W439yNdR7LfjatptRsaq7drT7b9Hzr9E/ItdMuCRYW+Gkxa7AcN3SnpSEe2gm mP4AlmZit2yjL5OYAkVg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXYY-00DfIW-It; Sat, 01 Oct 2022 08:09:06 +0000 Received: from mail-pj1-x1034.google.com ([2607:f8b0:4864:20::1034]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXYV-00DfGv-Rb for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:09:05 +0000 Received: by mail-pj1-x1034.google.com with SMTP id u92so6074838pjh.3 for ; Sat, 01 Oct 2022 01:09:03 -0700 (PDT) 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; bh=UdRum/NOsNc+q0b9g1DppGoBok9aodOHrcP30aJbUSo=; b=Ok5CPSQ6OeaY9s8wPGqDY3PMs6IrllTVYS8QnTFO7BhjybS9U0u8pzsbxRMK5RptvQ 6FdgIivQxzIVIthF74nKaEIjTB2fSr1gmzyYS/gZu15Jk7Wj5T78dsNiZMFnA4nk0TgU DP/xcmFNiGoM54uErLtZaSZpUBXF0ONClzKGQ= 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; bh=UdRum/NOsNc+q0b9g1DppGoBok9aodOHrcP30aJbUSo=; b=OTdod68JrEQqD6ExVrKZ5S6/MaffndT37z3bnI0uzdnrgvp6QYlJ7eu8bg24gHSUAL lh5SrNr+bVbAo6mGP/8oZVp/KoB5KfHtgOb/e+LcS6ORZbPUdcFchvGJb34qvIYp8DdW Dx21Q1xetkGib7eKRvY0tXJFqgvVQjaGBxzvqrEH0bQtoIIbZ3e4O/xzf+MpXHncWO4H BR2I0QnZjhrw4O9qZoJIPFhSG+5cobJu6KJcjICUWEi833MsnU69eJjNcpgfdICDD4zH QFDsvJz1Wh1yTRDR/M6KnVRjRNqMmQ4kdzRGyrHxhvDsj588rXtdyqvjxhHHhsHB+qZV bOiQ== X-Gm-Message-State: ACrzQf2ztACW/Zuh26OJqvJ4jPJO8iS54wMQ+bLvRHRJol2tivoomgNC SA8PRZSDLuUGnahC6PgIJiqUIA== X-Google-Smtp-Source: AMsMyM7V7eJB8pKnH98KIj4JiE7sIIimU6+Haft2I08ssQ1XVKcesdYO3L6LHgYA8aHXpmtfGcRMxw== X-Received: by 2002:a17:90a:8044:b0:20a:6412:3b8c with SMTP id e4-20020a17090a804400b0020a64123b8cmr2235484pjw.139.1664611742805; Sat, 01 Oct 2022 01:09:02 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.08.43 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:09:02 -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 v6 06/10] drm: bridge: samsung-dsim: Add platform PLL_P (PMS_P) offset Date: Sat, 1 Oct 2022 13:36:46 +0530 Message-Id: <20221001080650.1007043-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010903_932731_CF8F3452 X-CRM114-Status: GOOD ( 18.51 ) 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 Look like PLL PMS_P offset value varies between platforms that have Samsung DSIM IP. However, there is no clear evidence for it as both Exynos and i.MX 8M Mini Application Processor Reference Manual is still referring the PMS_P offset as 13. The offset 13 is not working for i.MX8M Mini SoCs but the downstream NXP sec-dsim.c driver is using offset 14 for i.MX8M Mini SoC platforms [1] [2]. PMS_P value set in sec_mipi_dsim_check_pll_out using PLLCTRL_SET_P() with offset 13 and then an additional offset of one bit added in sec_mipi_dsim_config_pll via PLLCTRL_SET_PMS(). Not sure whether it is reference manual documentation or something else but this patch trusts the downstream code and handle PLL_P offset via platform driver data so-that imx8mm driver data shall use pll_p_offset to 14. [1] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/gpu/drm/bridge/sec-dsim.c?h=imx_5.4.47_2.2.0#n210 [2] https://source.codeaurora.org/external/imx/linux-imx/tree/drivers/gpu/drm/bridge/sec-dsim.c?h=imx_5.4.47_2.2.0#n211 v6: * none v5: * updated clear commit message v4, v3, v2: * none v1: * updated commit message * add downstream driver link Signed-off-by: Frieder Schrempf Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 10 ++++++++-- include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 90506be3f2dd..d0bb96a275fd 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -168,7 +168,7 @@ /* DSIM_PLLCTRL */ #define DSIM_FREQ_BAND(x) ((x) << 24) #define DSIM_PLL_EN (1 << 23) -#define DSIM_PLL_P(x) ((x) << 13) +#define DSIM_PLL_P(x, offset) ((x) << (offset)) #define DSIM_PLL_M(x) ((x) << 4) #define DSIM_PLL_S(x) ((x) << 1) @@ -368,6 +368,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, }; @@ -380,6 +381,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, }; @@ -390,6 +392,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .max_freq = 1000, .wait_for_reset = 1, .num_bits_resol = 11, + .pll_p_offset = 13, .reg_values = reg_values, }; @@ -401,6 +404,7 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .max_freq = 1500, .wait_for_reset = 0, .num_bits_resol = 12, + .pll_p_offset = 13, .reg_values = exynos5433_reg_values, }; @@ -412,6 +416,7 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .max_freq = 1500, .wait_for_reset = 1, .num_bits_resol = 12, + .pll_p_offset = 13, .reg_values = exynos5422_reg_values, }; @@ -543,7 +548,8 @@ static unsigned long samsung_dsim_set_pll(struct samsung_dsim *dsi, writel(driver_data->reg_values[PLL_TIMER], dsi->reg_base + driver_data->plltmr_reg); - reg = DSIM_PLL_EN | DSIM_PLL_P(p) | DSIM_PLL_M(m) | DSIM_PLL_S(s); + reg = DSIM_PLL_EN | DSIM_PLL_P(p, driver_data->pll_p_offset) | + DSIM_PLL_M(m) | DSIM_PLL_S(s); if (driver_data->has_freqband) { static const unsigned long freq_bands[] = { diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 0c5a905f3de7..df3d030daec6 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -53,6 +53,7 @@ struct samsung_dsim_driver_data { unsigned int max_freq; unsigned int wait_for_reset; unsigned int num_bits_resol; + unsigned int pll_p_offset; const unsigned int *reg_values; }; From patchwork Sat Oct 1 08:06:47 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996440 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 AA66BC433FE for ; Sat, 1 Oct 2022 08:10:31 +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=8x3b4cYGCgqy/15oowfUl0pVT1gdWAQgUblMcIsC6Cg=; b=GmC9VQZjyAwrPe dE+cHwkOlxMYtn4T15HSuOxSKefSiPUfTXi/WcxfXD5tDp2j7iOKxbM6FbmWAJcUNd8lMQ/6JalmL acrICSHIUPS0ABQXwnRPmnuahyRXmOWt/HGgAuxaluGROIVMxAVsjoKF+cxeK+PcehEb+GmYHw1r4 ZCWspcseTzdjIyjmaU4HKIuTjOvwje87iDd5ruxWaWQiIaqeoP3kq+UZucNrwDQ0qUiPlGnRTYoOK ffsJxu0a+jOba7yjTB0jKfevy6mA7MDs5L7dRmaPS5M9H/QrV2Yz5bDOCm90dHL2N+RNpexV4siEC IThoIigEhHLfbAe0XCIA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXYw-00DfT9-Lu; Sat, 01 Oct 2022 08:09:30 +0000 Received: from mail-pg1-x531.google.com ([2607:f8b0:4864:20::531]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXYt-00DfRZ-PJ for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:09:29 +0000 Received: by mail-pg1-x531.google.com with SMTP id r62so5916773pgr.12 for ; Sat, 01 Oct 2022 01:09:27 -0700 (PDT) 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; bh=TCY0x6eQvb6PuLAvx0r46OGP8xrnsAWIiZpENV9TAdU=; b=cmcIDOPWyqbSr7pCiw3qQJm123Se8QJDui2fvrAiSqAz85Uc+d2bQRPzrwn9IoRL29 glr2KmCPNnWeRNjQFMExegFyBgyxBaSu8dfLT/xhVp1lA/C8r3xgL/noWtXOff7ezNSK BCN88Kh6aT2ENMnt0191cVQntl5TUl+egkz0o= 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; bh=TCY0x6eQvb6PuLAvx0r46OGP8xrnsAWIiZpENV9TAdU=; b=Fw9+xhPXA9cSTSLAKYGfv7QguUruDW8uMW1UwD2yTsdhsZx+KhDStU7cRne52xccKl HVfEd5bgPu+yrgrYY0mIlYLuKu8tlIvmqmi1FjjMYb1wfeqEguWl7C2otB5ZTmA7Qv6E cXZXh8FORWiMUyPNncBSya2RiktZSyEXhuSEdq8BWqKPER5FUFPVbQVsS594LIkDwDwM 94SZcZnpvnu/5CNJJTzraj9/uuWPuyi+byKlVuJEyhhy5pdJjnL3nqxQl9w3bsPBdpdz MRgULXOVqbFyq06oWnJ04dYhTIxGslBTxoBOztNkDr8Lu3IIlWNTYvtOWpK648vkchWm RZsA== X-Gm-Message-State: ACrzQf1l2PQrieptI4KjDMqT69scpHYnGCH60Saks4lROcE+OWz79cIU DzQc+qcJL8Gty3K1+bvXm7QZtg== X-Google-Smtp-Source: AMsMyM6MZyUR/fquK4gZ8vuUpoa5brQ0Dl6ssuq6KJE0MMIgNI+rmdEvrf35QwYtOGjFWhpOObHGyA== X-Received: by 2002:a62:ee0c:0:b0:558:5c4:97dc with SMTP id e12-20020a62ee0c000000b0055805c497dcmr12889924pfi.14.1664611766824; Sat, 01 Oct 2022 01:09:26 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.09.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:09:26 -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 v6 07/10] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts Date: Sat, 1 Oct 2022 13:36:47 +0530 Message-Id: <20221001080650.1007043-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010927_841858_25F34357 X-CRM114-Status: GOOD ( 16.02 ) 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 Finding the right input bus format throughout the pipeline is hard so add atomic_get_input_bus_fmts callback and initialize with the default RGB888_1X24 bus format on DSI-end. This format can be used in pipeline for negotiating bus format between the DSI-end of this bridge and the other component closer to pipeline components. v6, v5, v4: * none v3: * include media-bus-format.h v2: * none v1: * new patch Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 28 +++++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index d0bb96a275fd..4fd77172bb4b 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -15,6 +15,7 @@ #include #include #include +#include #include #include @@ -1321,6 +1322,32 @@ static void samsung_dsim_atomic_post_disable(struct drm_bridge *bridge, pm_runtime_put_sync(dsi->dev); } +#define MAX_INPUT_SEL_FORMATS 1 + +static u32 * +samsung_dsim_atomic_get_input_bus_fmts(struct drm_bridge *bridge, + struct drm_bridge_state *bridge_state, + struct drm_crtc_state *crtc_state, + struct drm_connector_state *conn_state, + u32 output_fmt, + unsigned int *num_input_fmts) +{ + u32 *input_fmts; + + *num_input_fmts = 0; + + input_fmts = kcalloc(MAX_INPUT_SEL_FORMATS, sizeof(*input_fmts), + GFP_KERNEL); + if (!input_fmts) + return NULL; + + /* This is the DSI-end bus format */ + input_fmts[0] = MEDIA_BUS_FMT_RGB888_1X24; + *num_input_fmts = 1; + + return input_fmts; +} + static int samsung_dsim_atomic_check(struct drm_bridge *bridge, struct drm_bridge_state *bridge_state, struct drm_crtc_state *crtc_state, @@ -1384,6 +1411,7 @@ static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_get_input_bus_fmts = samsung_dsim_atomic_get_input_bus_fmts, .atomic_check = samsung_dsim_atomic_check, .atomic_pre_enable = samsung_dsim_atomic_pre_enable, .atomic_enable = samsung_dsim_atomic_enable, From patchwork Sat Oct 1 08:06:48 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996441 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 E2EB2C433F5 for ; Sat, 1 Oct 2022 08:10: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=EnHHkjjtyLJQndFu/3HyngVR5A6iW/Iz6eJc+lEwkhs=; b=KyGl839e4nlShg E4wETD+xldKx05KE72y2Hj43FkoC8WlV58h5zbl8FJh8D/tfEP14xtrSXup5rmNt8eM9Vj2lkE+bZ Q/KUATZEY7kxrAui/muFpCD1WoX8dp/MUJNKPQhfGJo2WdNqI5u1uvIJ8pLqs5QYL3jbFbe6KCq8L II5Q6yR4jcxhaDqyrEAnQ0r7gvag4e1sWoWeB/t/yYWh7OaHFof0M1qTqgWvb24esX8nRmAn++SDF fzU4hXkkA6Dx8/ASW2MlsG/nTL/5WEcJuuWHpJ2uAtIfsVrWrdkDFbOMHMeWKfjz+s+zUiizCqMGj E8tQS8IF2E/JZuH332Pg==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXZD-00DfbP-JZ; Sat, 01 Oct 2022 08:09:47 +0000 Received: from mail-pl1-x62e.google.com ([2607:f8b0:4864:20::62e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXZA-00DfZf-Rk for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:09:46 +0000 Received: by mail-pl1-x62e.google.com with SMTP id x6so504676pll.11 for ; Sat, 01 Oct 2022 01:09:43 -0700 (PDT) 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; bh=bIsBpWYKGaRb2gfWU/8omTUwq6r8O+ulvfUN+TCAIdY=; b=lfTdedK41vWtMebW3Wcp94YL7ucmrlEryRuuPWEj+o7FAAPRkjDA+9D5Pac+YlQm3+ pBpTLZbP/U95I+bN063h+cFVsvEu91POyJnliuPN/4No7TVkOfPBVS12IJtx/3QVP//U RcI9Ck1SO4KholGKAGSZoHwFS9y8khcFmTCA8= 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; bh=bIsBpWYKGaRb2gfWU/8omTUwq6r8O+ulvfUN+TCAIdY=; b=XJg+qGma7zA8eqIipwXMKqNSD6pW+ywHOGHI1bRzR1C0O/lw+F6KHRFhqQl4jIZ28e 6O413iWHaj6IHeuuGbo0D5/EZeeZNjiMPrPU0GjG82yh5hgelec0qHdJkh6SrfTsyxUw y5CIzbsiAYsou/Ao6e5yVHZwjAi1mh0r8C2rtLRH4m9G50s12rvBsDhIS/F1/GqaoVXz lIbxIj54ZFxxB1H5W5+S8RNhwlTmvIXIJkD3btQ/nMA4P//+US4UyZ6+9dbKI8heg2ZM JUVz0KQhSBL81JZmf50vHFsQdU0WWAFscheu4pGOynLw+FdJYmnmedo+VdfO/J+KDMom 6A8g== X-Gm-Message-State: ACrzQf0PUSyyH6nxZc69InT/JVcG9RKaxbanLE4Ylyw0PQJU1iZho4yA wPVoWLtDuuFdSxvJT3VtCbxhSg== X-Google-Smtp-Source: AMsMyM7A6yv4u9IjhcSR+PGTiZiBShQT4hp8vwLtDbTRUwpJ55h1OAzyFhyKY2oLDVzQW/Ntc0WcjQ== X-Received: by 2002:a17:902:f650:b0:172:8ee1:7f40 with SMTP id m16-20020a170902f65000b001728ee17f40mr12989210plg.101.1664611783492; Sat, 01 Oct 2022 01:09:43 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.09.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:09:43 -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 v6 08/10] drm: bridge: samsung-dsim: Add input_bus_flags Date: Sat, 1 Oct 2022 13:36:48 +0530 Message-Id: <20221001080650.1007043-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_010944_988717_11B96C5A X-CRM114-Status: GOOD ( 12.45 ) 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 eLCDIF is expecting to have input_bus_flags as DE_LOW in order to set active low during valid data transfer on each horizontal line. Add DE_LOW flag via drm bridge timings. v6: * none v5: * rebased based on updated bridge changes v4, v3, v2, v1: * none Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 4fd77172bb4b..49406a07d655 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1601,6 +1601,10 @@ static const struct samsung_dsim_host_ops samsung_dsim_generic_host_ops = { .unregister_host = samsung_dsim_unregister_host, }; +static const struct drm_bridge_timings samsung_dsim_bridge_timings = { + .input_bus_flags = DRM_BUS_FLAG_DE_LOW, +}; + int samsung_dsim_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1681,6 +1685,7 @@ int samsung_dsim_probe(struct platform_device *pdev) dsi->bridge.funcs = &samsung_dsim_bridge_funcs; dsi->bridge.of_node = dev->of_node; + dsi->bridge.timings = &samsung_dsim_bridge_timings; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; if (dsi->plat_data->host_ops && dsi->plat_data->host_ops->register_host) From patchwork Sat Oct 1 08:06:49 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996442 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 ED89FC433FE for ; Sat, 1 Oct 2022 08:11:18 +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=oQqa4tMB81hL9hGJgrOZ5pfJad8/Xxq4m5lFCiZI9ZQ=; b=z3dMY3CkHhUz2T ftWQ3h0rYeq42NKRapT0NsQBLc98a8aJ+6ZEqa0u1FMXcAgDJQTNYnaFcDXHo0pw0x6rPYIuDjKvN YK9GYVIAHwQc/EwqycN/nYXlN+K6dQaU7KO0sYp6oVo4romuIQ+8ZgbxADiic5x6yuW0KsZlwHvNC O7HPGa82Xid20becOWYihPJ3Sh85aSXKb4gNowYkZPevwghHTXS9VjJDPLVsDkpzycRNOjRArNQj9 MiLfK57xLCOz+vmqMspHiQRrI5UxvfsAgpvTRYL6S8TJZN6Eub1IGnPC2+ryj8YPuy4JeBOnLYFEV 5dzID1eERrQqC+TvnnGA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXZi-00DftD-SA; Sat, 01 Oct 2022 08:10:19 +0000 Received: from mail-pl1-x635.google.com ([2607:f8b0:4864:20::635]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXZg-00DfnO-0D for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:10:17 +0000 Received: by mail-pl1-x635.google.com with SMTP id x1so5784423plv.5 for ; Sat, 01 Oct 2022 01:10:11 -0700 (PDT) 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; bh=/wOwPBnm9F+B6EUxE0EwDr5bec7v1ZzaQI0ncINcEEQ=; b=Yr+KjrdROxVsREjh1ynA2uo4DlPOxokxTsDToUrFOH2o7Dt17vXjhGsqWwiKK5X2Sh L/9HN67ayNzogP9iWvS0oLGQWZgKr27VJr/e1NVphMK/siE+j4pi+5kfpq5jhEK+f4M8 3dKNSUbd3ilmJ9AbAvEr93KHT3MlN8PSp6Fy0= 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; bh=/wOwPBnm9F+B6EUxE0EwDr5bec7v1ZzaQI0ncINcEEQ=; b=UPNNxE2VutxcNlng5Egr5v5la94x1mzCCk2qUYoxn3Gyxz674i9BxH+S7fsJ6SJPgw iFpW5PTphtZpEGFvetLNuxzPVCg/mIEHrTR5UtajAn7E5dsqJZLeUY86sxoflrct6kjU tB28quOCiIfmJNdyxQiVgwALUV7cze/dCCJ0T/DF8vFlk6Wrqt7dRje7SFNS3tw0Jw0w Z8KLSND5EeI9s/LB457zMvZFhvGTN2NsU87/aoHOBDyAEjY0a+zIzmI6p6Wk4ZqM4AcX B/9xleW7rhu8vTBwQgQozsLH6niFyM0+al1/zFJFULQC0FzyQwunH06rPBo49beAzF+s U8tQ== X-Gm-Message-State: ACrzQf2m9eR7JlDF2GBpPNAnsbu5KtW4ywcn720kXQ9BDySZFHd7s2s6 gdcRccXAsidULP75N7Y3ES3VZQ== X-Google-Smtp-Source: AMsMyM4WWThhOeR7xZ08N6zla/HEqxatjILfotzm2bCjMVN+iyfgHlEjngVKbpobMpMRcufvi+o3ww== X-Received: by 2002:a17:902:9a49:b0:17a:6662:9334 with SMTP id x9-20020a1709029a4900b0017a66629334mr12368026plv.63.1664611810678; Sat, 01 Oct 2022 01:10:10 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.09.44 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:10:10 -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 , Rob Herring Subject: [PATCH v6 09/10] dt-bindings: display: exynos: dsim: Add NXP i.MX8MM support Date: Sat, 1 Oct 2022 13:36:49 +0530 Message-Id: <20221001080650.1007043-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_011016_080627_93E4F5C1 X-CRM114-Status: GOOD ( 12.16 ) 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 Samsung MIPI DSIM bridge can also be found in i.MX8MM SoC. Add dt-bingings for it. v6, v5, v4: * none v3: * collect Rob Acked-by v2: * updated comments v1: * new patch Acked-by: Rob Herring Signed-off-by: Jagan Teki --- Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt | 1 + 1 file changed, 1 insertion(+) diff --git a/Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt b/Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt index be377786e8cd..8efcf4728e0b 100644 --- a/Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt +++ b/Documentation/devicetree/bindings/display/exynos/exynos_dsim.txt @@ -7,6 +7,7 @@ Required properties: "samsung,exynos5410-mipi-dsi" /* for Exynos5410/5420/5440 SoCs */ "samsung,exynos5422-mipi-dsi" /* for Exynos5422/5800 SoCs */ "samsung,exynos5433-mipi-dsi" /* for Exynos5433 SoCs */ + "fsl,imx8mm-mipi-dsim" /* for i.MX8M Mini SoCs */ - reg: physical base address and length of the registers set for the device - interrupts: should contain DSI interrupt - clocks: list of clock specifiers, must contain an entry for each required From patchwork Sat Oct 1 08:06:50 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12996443 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 9A134C433F5 for ; Sat, 1 Oct 2022 08:11: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=rfnY6jJPn66ezQSd2ci+3790WfBAW+7WjIJ+9/ISJ9w=; b=AeYPL20xxZAwhE HaxZyUZL0Ox/3O+IhFvHzDCpAadtD7tCINP8xCJJxgl29ppew+pl1ZDlv8LebKwpQRUUlI9FrAYmk 1Z9ethJwf5bvsMsUlLSXDwo79e32Jq6P6W/hmWbzB92Zfzd79tGRsNpO0jl+j5r5A4MkMg7XHkou/ 4Yu+EBHoFKpM5Sq4eAV9uMFsK/k105tGtUNyUapBUEf1awZfXlTfC0tmXi2CW9zflJ8F5ROnEcgVK qRn9yvshpHrbkK/401uIXe6oSDPKRqi9/jF+LZ7GCoa5L7pzq61iXCZ18/7BK3PyoJ5zZUM6xLuFg nRTxZMEKXe4bXDRs0khw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXaD-00DgBJ-So; Sat, 01 Oct 2022 08:10:50 +0000 Received: from mail-pg1-x529.google.com ([2607:f8b0:4864:20::529]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oeXZx-00Dg0z-Ha for linux-arm-kernel@lists.infradead.org; Sat, 01 Oct 2022 08:10:35 +0000 Received: by mail-pg1-x529.google.com with SMTP id c7so5930690pgt.11 for ; Sat, 01 Oct 2022 01:10:30 -0700 (PDT) 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; bh=kNa+Zfrt6fq++pnj2gbp7R05J06qVtRoBZLGkH8PcDw=; b=rQNF8tS3D8hzncMnTgYSuGc+gLkkyeTDUFY65I2upJJTz0b+WESJ7QdmimtnMWH0rb KW66vBsWy1Qq3Bf/PPvbOmOlqWjNvZMamWOOI9GYA8y64cylcg7ritGD9WU88bCHtFpL hdghmA0BNMDSthG9kGVOFyhVKmiWyW1/dfxeo= 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; bh=kNa+Zfrt6fq++pnj2gbp7R05J06qVtRoBZLGkH8PcDw=; b=IxG9dk1ns/jnWEGT/bRYB4qerFY0AuRHPR3Ju7fLGKZM+BrObRu5EVtd3mVkFYf05F iyDHu9KRVM0UE3lK3YKrha0kGMJdOXWgHriDUpGTo2BJotG8XGbbkZCpV2ZoER5eBssN 7rU4ENyK1GFV5t6MruE6cEfBY2pZHh/F0tpApN4an9DZNBXCbv60aGtu1vQBhzaNdNXV pCJ4BNyAZGyjeh9dgiYYhMA8ec3KfuN5xzipRb5evKy02pDyYlpIjUli5nqRfA/FrlD8 klgm2pf9APhEttz+JKRkjEEY49DKoyf0DfN0hiwQal+HDm7BBSa/0+4JC6vnPnuVtFl/ InwQ== X-Gm-Message-State: ACrzQf1XRIEU0i0/jrTkpS99L+NLabFr2lmgs2b/RAGXjA0asHByyp0C zIqJLHijiIxLJxUWG1iwn05aOw== X-Google-Smtp-Source: AMsMyM6c3fu8pImibJC5IG2/qhDWNilZ4L/Bcb8g67ranqSll74i2Xn5H+8BxaQu6z3I3bCVKDOp0w== X-Received: by 2002:a05:6a00:cd6:b0:546:d03:3dd7 with SMTP id b22-20020a056a000cd600b005460d033dd7mr12926362pfv.19.1664611830363; Sat, 01 Oct 2022 01:10:30 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:7254:4392:bc7c:c69]) by smtp.gmail.com with ESMTPSA id c194-20020a624ecb000000b005409c9d2d41sm3167041pfb.62.2022.10.01.01.10.13 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 01 Oct 2022 01:10:29 -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 , Laurent Pinchart Subject: [PATCH v6 10/10] drm: bridge: samsung-dsim: Add i.MX8MM support Date: Sat, 1 Oct 2022 13:36:50 +0530 Message-Id: <20221001080650.1007043-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221001080650.1007043-1-jagan@amarulasolutions.com> References: <20221001080650.1007043-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221001_011033_634028_F7CA5F9E X-CRM114-Status: GOOD ( 14.98 ) 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 Samsung MIPI DSIM master can also be found in i.MX8MM SoC. Add compatible and associated driver_data for it. v6: * none v3: * enable DSIM_QUIRK_FIXUP_SYNC_POL quirk v5: * [mszyprow] rebased and adjusted to the new driver initialization * drop quirk v4: * none v3: * enable DSIM_QUIRK_FIXUP_SYNC_POL quirk v2: * collect Laurent r-b v1: * none Reviewed-by: Laurent Pinchart Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 45 +++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 49406a07d655..5f2c51428cdd 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -360,6 +360,24 @@ static const unsigned int exynos5433_reg_values[] = { [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0c), }; +static const unsigned int imx8mm_dsim_reg_values[] = { + [RESET_TYPE] = DSIM_SWRST, + [PLL_TIMER] = 500, + [STOP_STATE_CNT] = 0xf, + [PHYCTRL_ULPS_EXIT] = 0, + [PHYCTRL_VREG_LP] = 0, + [PHYCTRL_SLEW_UP] = 0, + [PHYTIMING_LPX] = DSIM_PHYTIMING_LPX(0x06), + [PHYTIMING_HS_EXIT] = DSIM_PHYTIMING_HS_EXIT(0x0b), + [PHYTIMING_CLK_PREPARE] = DSIM_PHYTIMING1_CLK_PREPARE(0x07), + [PHYTIMING_CLK_ZERO] = DSIM_PHYTIMING1_CLK_ZERO(0x26), + [PHYTIMING_CLK_POST] = DSIM_PHYTIMING1_CLK_POST(0x0d), + [PHYTIMING_CLK_TRAIL] = DSIM_PHYTIMING1_CLK_TRAIL(0x08), + [PHYTIMING_HS_PREPARE] = DSIM_PHYTIMING2_HS_PREPARE(0x08), + [PHYTIMING_HS_ZERO] = DSIM_PHYTIMING2_HS_ZERO(0x0d), + [PHYTIMING_HS_TRAIL] = DSIM_PHYTIMING2_HS_TRAIL(0x0b), +}; + static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .reg_ofs = exynos_reg_ofs, .plltmr_reg = 0x50, @@ -421,6 +439,23 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .reg_values = exynos5422_reg_values, }; +static const struct samsung_dsim_driver_data imx8mm_dsi_driver_data = { + .reg_ofs = exynos5433_reg_ofs, + .plltmr_reg = 0xa0, + .has_clklane_stop = 1, + .num_clks = 2, + .max_freq = 2100, + .wait_for_reset = 0, + .num_bits_resol = 12, + /** + * FIXME: + * Offset value used from downstream drivers/gpu/drm/bridge/sec-dsim.c + * remove this comment if it is true else update the logic. + */ + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, +}; + static const struct samsung_dsim_driver_data * samsung_dsim_types[SAMSUNG_DSIM_TYPE_COUNT] = { [SAMSUNG_DSIM_TYPE_EXYNOS3250] = &exynos3_dsi_driver_data, @@ -428,6 +463,7 @@ samsung_dsim_types[SAMSUNG_DSIM_TYPE_COUNT] = { [SAMSUNG_DSIM_TYPE_EXYNOS5410] = &exynos5_dsi_driver_data, [SAMSUNG_DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, [SAMSUNG_DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, + [SAMSUNG_DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, }; static inline struct samsung_dsim *host_to_dsi(struct mipi_dsi_host *h) @@ -1788,7 +1824,16 @@ const struct dev_pm_ops samsung_dsim_pm_ops = { }; EXPORT_SYMBOL_GPL(samsung_dsim_pm_ops); +static const struct samsung_dsim_plat_data samsung_dsim_imx8mm_pdata = { + .hw_type = SAMSUNG_DSIM_TYPE_IMX8MM, + .host_ops = &samsung_dsim_generic_host_ops, +}; + static const struct of_device_id samsung_dsim_of_match[] = { + { + .compatible = "fsl,imx8mm-mipi-dsim", + .data = &samsung_dsim_imx8mm_pdata, + }, { /* sentinel. */ } }; MODULE_DEVICE_TABLE(of, samsung_dsim_of_match);