From patchwork Wed Oct 5 15:13:01 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999351 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 65217C4332F for ; Wed, 5 Oct 2022 15:14:54 +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=QBULoO7BqBPZNbujoGm4IlqZpJ7fpoMx/Y7TdO1CHQI=; b=swAx1Gmrikaj8y vGe8M56FNTr+uqdMCCdVeUdam8VwjHQ/YzOKjfAf6DrtKUcZ3FuwW4I0hFuBdjK4a8F0NC5AK9dYQ FBBNcnW2xewYpyI0aFdqEv/plpeGNRx5xlXJMafDszPtnK0Y7Rqz7KaD92Gg3cA8/FD/wGnLGNckg i5lALSmfbjLbX6XUbnQCuc6qzrNXVpJM0+hmLG+13AlLPHjOaoioNEzb0JXQz/qLqqszIoHmY5ozg 5E6S3+1CwIMFqkWZYd+7MZJ6kL9CsILYQCZhkElmXa/sJO3hDfBPXOhSTDmKZFcyGTA9aWXxyTVc2 8YD1QC0FX8LcxwU8a/Gw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65l-00En5V-GY; Wed, 05 Oct 2022 15:13:49 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65N-00Emxj-2Y for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:29 +0000 Received: by mail-io1-xd33.google.com with SMTP id s16so2054508ioa.6 for ; Wed, 05 Oct 2022 08:13:23 -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 :message-id:reply-to; bh=oZKBZ/Poq4qIDgukJ06pdFkyQHbBE5/VJ3pRiELlmgY=; b=CycY5tvqQX7XlhnNAyQclQ9wN9sBRLKSHjUaZ+2ZIdR47bIf/4sh6oAm0Boem+mxED NwOLrgJEPJ40HVe7uRW5mKdquNOOzm6RBT8u/zYY475ZvWdtNgCp9qIcl0pRk9AJCSEd ZPNC8GOeWscs9RfZyYlOKWnYRfkd4iN779dKU= 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=oZKBZ/Poq4qIDgukJ06pdFkyQHbBE5/VJ3pRiELlmgY=; b=VHTP+auqjzJKn5MRzAYgrEp2AvUzIlo8+/Bv8fnHoEAaXR50Sm3zD4nq9vpvZMl1v7 IUWN37BdEPYhqgtUZvdnV+f+GtbyfKZPPdZPlDX1SprBLjOYBFFiM+GEcYc+LjBSDj9n IYYB2viFnW7mkYhb3Nsq+5G0auMFWJVoFq/gQfdo0ZEBaQJ+WJ4+iF+HTcbs05cxp8Xs eK4QZATjVKHpLT0MEPVyo6p3cs2UEJITR5tKALZA5kQ7CqSYftgFVnnUJVP3Pym+7xBT O/PU7xQ2pMcq+6/zCgsPyKkrmDyUwQy32Bhb7t/v9JcWAMpy5uA/mHYcqjdPWjQ6QOQu O/1Q== X-Gm-Message-State: ACrzQf3Hf3rqunBZVvtfPDUKeZgss7BL4RdX219W5uAUMirZ5JGtX3gW w/gzAMANuHYVjeTbeBUe6sUODw== X-Google-Smtp-Source: AMsMyM7+6E9CcbOMePBdcd4NW1DHDNKXHeuu0sWSYmYK93I3b4G0DhEsd2CVNuB3ZL4DZZuGofKtpg== X-Received: by 2002:a02:9f88:0:b0:362:74f6:6215 with SMTP id a8-20020a029f88000000b0036274f66215mr67503jam.2.1664982803307; Wed, 05 Oct 2022 08:13:23 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:22 -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 v7 02/10] drm: bridge: samsung-dsim: Lookup OF-graph or Child node devices Date: Wed, 5 Oct 2022 20:43:01 +0530 Message-Id: <20221005151309.7278-3-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081325_158633_14FAA613 X-CRM114-Status: GOOD ( 18.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 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. v7, 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 07563d00a420..c34c6abac815 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 Wed Oct 5 15:13:02 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999350 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 8E863C433FE for ; Wed, 5 Oct 2022 15:14: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=YxJRk5KFx6nX56TGruttmDK0RmDET+Fq2ozc+U5IFgE=; b=u1xquaZtts3FqL 6MXn2TbMfYSm5hwA2uYXHOEu31r1B2NKpWMb7s5XfHV3H2lfpFxZvnhNxC+1b6Op1ksSomG8+YzQa rWc3uuWMTc9Qtak7PE6V1FON5q7beTmvSE42KcJ6JsCh15E8sHuC9n/y8IEm108cx8x9UBWBb8NXK vDY46qEUTAPusErvz0UAx5kLWwJYflo+5m4qbKPdTPc3pxs6zkoyqNiRh7m+WjzB2ccFR47T33nUy w8oijfPYaiV8fGnwizF76hkCQlxuPnGaWBDJUP3LqzbfxlGo6NLXLlWLpDi74Gdsbh9zfInrIXTGD zWMA/pLzZUZ0M0UOHFXw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65a-00En2k-AH; Wed, 05 Oct 2022 15:13:38 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65O-00EmyN-SD for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:29 +0000 Received: by mail-io1-xd2d.google.com with SMTP id n198so1709978iod.3 for ; Wed, 05 Oct 2022 08:13: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 :message-id:reply-to; bh=+gTdmBPImvmtEVJ8K/TFFMRIl9dCboj/pEZUj0+angg=; b=hRGiJg6r86Qx2vzcgKNRqffsScJo8TRPdUfC2V5sazPpG16nRUdDbe/LNhd+x6tdw/ 3kmzy8kPdvpwvaGJcmL8NHs3ph8WEPww4T+zX2vbyxg07MWdFH6Xg4kUhjcYm8ZmV/pX Wdyyc1BttPpcC9bKRU/RGVMZBCT0wpNjeuLtg= 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=+gTdmBPImvmtEVJ8K/TFFMRIl9dCboj/pEZUj0+angg=; b=DLwF19EX3rNb4BwhUT5u0daFabAD+lu51NsQObuMYFkG1pMXwQL2DSJku4db1tFd2C Tij6DdE1kNO2Fqqm6oym2bCcUoaaI7cBhEB1T3KWyfio705xHenSBg3Uvho9KUsEU7c7 aSO0KHKgwJezlKi//bU1wNuqYapH2uXZwKWfRhKL69gsXqBMh7AGkfHXpDhywGXK2+fo Wdzhrp9guZgEdJKhSzZxK/jC8F6wH3bzJotqVu8axoLYtH2eMDeDT+/znyfp41zp6XkC 2p25VCOE+pUBcIyg649gwmJx8rQunpRIaE7vxW1zN18HE26aN/08/fAhljA6jMLZBTOd KnTA== X-Gm-Message-State: ACrzQf2CqhUjJS00fxiytpest2f3EgSpNbp+6wcn+/5/xGxL+lv4oMHz WwNUJdDnICgTRSZWqDwsh7DsSg== X-Google-Smtp-Source: AMsMyM669NtZBL1QivoK8jgGFSq7WGsixMsDmqYfcu/B429dwt1+UYojmwbDgFtiJAkyBn4M5fDE2w== X-Received: by 2002:a05:6602:1609:b0:6a1:899e:bf36 with SMTP id x9-20020a056602160900b006a1899ebf36mr146502iow.121.1664982805048; Wed, 05 Oct 2022 08:13:25 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13: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 v7 03/10] drm: bridge: samsung-dsim: Mark PHY as optional Date: Wed, 5 Oct 2022 20:43:02 +0530 Message-Id: <20221005151309.7278-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081326_970379_D47F30D7 X-CRM114-Status: GOOD ( 13.62 ) 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. v7, v6, v5, v4, v3, v2: * none v1: * new patch Signed-off-by: Jagan Teki Reviewed-by: Marek Vasut --- 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 c34c6abac815..1bae3673151b 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 Wed Oct 5 15:13: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: 12999352 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 1B305C433F5 for ; Wed, 5 Oct 2022 15:15: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=NqujjCJ+CACev4ShkmzZp+otc/oFr9F4vRZoBWg79xM=; b=HaQqBzzE8OITuy jRuRnJn1cGmNuSJfOYJvAcpTKrqpETYboc6/BErBcpmitNb2PdorkMGiBnHHervfssY/j+qyqP28E mBrK1xzGxIo1027oaihSYCM1sMz7sB/Bjf2uN0pHptjr6BlG35a7mz9NZ5Qdaadcwia4ZL7Xlzkfl ig6Hzyy1HBUB7+t+rZerFdFk3Jd+CzaMS2jsNOy48lZlv8LwmOui1hkxI2QZ468msq/NxzOyfV4h1 ySvAA6jpN3XXyaZhj3m2lzO8vFTjznN864SkbZe4vHwPhVi3BgXBtSh88XKDmJlh2gE71NkOCRhcP TywMb8zGdNFrM4bhZR2g==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og660-00EnBE-97; Wed, 05 Oct 2022 15:14:04 +0000 Received: from mail-io1-xd2d.google.com ([2607:f8b0:4864:20::d2d]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65P-00Emyr-Ca for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:29 +0000 Received: by mail-io1-xd2d.google.com with SMTP id e205so13055002iof.1 for ; Wed, 05 Oct 2022 08:13: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 :message-id:reply-to; bh=CTE4OyoAPPvHX4/voYrSXggdSk25Ceo5ZBjV7AJSfnQ=; b=c5/d6Kr0FFnq30GHdmiuMG2sUP0T5m/KQzZqYN5lgKNE0NGjYSyg1kF81kpvPCTIoL AENd7cCb5meoc5UDzQZmaBruBQotgvTERB8G06jevzdtyrj8p8YGGfqvKav0XY3B+Yhf Kfvt8icGywu0qYhuJ6hNRoaFSV8lfnkVcLz6w= 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=CTE4OyoAPPvHX4/voYrSXggdSk25Ceo5ZBjV7AJSfnQ=; b=PNQyNHzawz02t6vhz/E9/XlQzLpIjyOXJLhOHCD6XMZNO3bjniH4oKwRyFGZR2aC4p qUREhYWAMqIBfCvfAeRfHxGK0KrkG/Q/fow1mihF+AZ1JYB4GJgyOd3oXx/eJI/TDqhf x5goOn3FbJp7xdPOfydhD0tgOJ6thgVdEzpvo+f3qYsQBOZYXd83GWlTagyrH2rK00FJ Jp899HgQf/doH5+8IdUIPVGXPKiQzZ2FO9KI9wMYi1wYecWvP7Wc+ZpcQ+q3sECENihI RvrfVegZlqDF3yrwmpDVNe9JSp+rU7JiNe0DH2R+fqj2jkt/FcbmEWGT9DJqrFzDkzZ8 yqKQ== X-Gm-Message-State: ACrzQf2hoDnhUzn1kRVZI//fo0FDgVcZTOhXSjOrQmxgM2xqkSe+vwz0 tMbQREtDPau82OZ5BLnvmUcnxA== X-Google-Smtp-Source: AMsMyM40pIuHfCdrxZqp1NZDN/lFDmsgc2lreRe9h5tfHkJksCNCxPUH6RvZ3c43rzSAfevYpzbwQg== X-Received: by 2002:a02:ccf9:0:b0:356:71fc:26a5 with SMTP id l25-20020a02ccf9000000b0035671fc26a5mr49162jaq.165.1664982806826; Wed, 05 Oct 2022 08:13:26 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.25 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13: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 v7 04/10] drm: bridge: samsung-dsim: Handle proper DSI host initialization Date: Wed, 5 Oct 2022 20:43:03 +0530 Message-Id: <20221005151309.7278-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081327_465870_1B39189D X-CRM114-Status: GOOD ( 18.04 ) 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). v7, 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 1bae3673151b..563781bb27c4 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 Wed Oct 5 15:13:04 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999353 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 19660C433FE for ; Wed, 5 Oct 2022 15:15:34 +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=Ym0Olx4uU4hVhK24AFvMlLl+sfxnKwzWPErg7JqOyoQ=; b=xGq5g8SeZUmrKf dsWX2PpybTKQaXJRdGbvg9yyERN0vPsy1SNDqLZMiWdg9Tuk7p75zsSM+81m8frQrlcr5YSk8JxPv 0h0H6nAhLFUTwq0MMCzUsvX6fnp6RgXymAAS9dxN8s6I6jqDW/52FlPRFH5x3UH1TlLVGBfMxKYP4 xmhAXTvxOkFBfmiMgEYYuB/yZt9/a8dxuwT55y6ZfWwFwJw1j9kGn7yh1amezjxoh5W6EqViFHYuG CzETdwvK7WC+a+vNTum3/AZIWWEUiDnfD9XnTpB1Ji4ze/37weldrSG/Ymz5WHMSGCU3556ZQwE4F E8LgiLD/1+brhKN0BcQw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og66P-00EnO5-TV; Wed, 05 Oct 2022 15:14:30 +0000 Received: from mail-io1-xd2e.google.com ([2607:f8b0:4864:20::d2e]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65S-00EmzU-EE for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:32 +0000 Received: by mail-io1-xd2e.google.com with SMTP id o65so2971292iof.4 for ; Wed, 05 Oct 2022 08:13:29 -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 :message-id:reply-to; bh=RQZh1WL8LN/9jE0F7Kfj3L3iyOE3VYmZbk12zg0k2YE=; b=QmcCZNdjvn4xJDQhu1/YU9JkJPrdAbyl4Kc7KfNzdq6AH8j4Qk15udzMAvjGNlLwDf ravXapf48/bcPFQb+zX8AcbMhIpUkjAYVsbg3kZv/pXDz9ZhNqiiYxs2Wul45mEQph0X hvEGxqx7oUbQkJAow9MpjbjKvsmeY0X33QysE= 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=RQZh1WL8LN/9jE0F7Kfj3L3iyOE3VYmZbk12zg0k2YE=; b=6WiuACrcoLifMh160ncaF/EnNIYkpvT1zAr19muPjWk9VlPd8niqNdD7Tr3MqIw3yC N1lClNC+6Uumu73PNBgwO36N5boBvoocXevoyHlOFjRjZ2pQ8Bu3w8HECVU5N8QpKIlB WNSGtafglTdd95hPT86tjd5DL76WY1+fVyFMGNZ4CGeAc+8BdejBqt70YPNW9lFujyAo 93qJJ5e/Y6Ck+TacKbNmyQQGopJTLacNUKSFl4ufvOVoElHlgr6iJYRQOKx2OYdn62aT FoiARP+VMV7cHkw3CUfXfuYZ0Gt2ODrikfEqcL3cQnGZyM6DvkYCsxuHIPFBHfuihE5M lVTw== X-Gm-Message-State: ACrzQf32npfbm88md2MRgkFq8/myxOZ7XBdZkX4YPWhGd+2pKapSPiC+ QDD9cWT+NOjtsfOznjZW8Hdwpw== X-Google-Smtp-Source: AMsMyM55piOjJ29rBh3EAxJKxdmTnLY6qdSde/uB4CpDbefwoxKucpm391ho7Vm67rBWK1zmLX9zqw== X-Received: by 2002:a02:cc85:0:b0:363:3812:9509 with SMTP id s5-20020a02cc85000000b0036338129509mr44215jap.249.1664982808649; Wed, 05 Oct 2022 08:13:28 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:28 -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 v7 05/10] drm: bridge: samsung-dsim: Add atomic_check Date: Wed, 5 Oct 2022 20:43:04 +0530 Message-Id: <20221005151309.7278-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081330_541264_26506074 X-CRM114-Status: GOOD ( 15.47 ) 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. v7: * fix the hw_type checking logic 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 563781bb27c4..b46346232c52 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 Wed Oct 5 15:13:05 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999354 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 5F2C1C433F5 for ; Wed, 5 Oct 2022 15:15:56 +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=Av6ZB5RR3HQJ70pbd/jTUcn8iz5iGGsMB7q3K6wMiyo=; b=gTUhlQ3z/E+L8s 8ndSB4wBmXBW2qJex5FUcA2F0shHGPp2KxTNn/BrK/582llSFjBPj4LOzh6Qg+c19O/+AA6A8xZrx 3ZWzdBawtAdUkIJIXnT85kYWkOMpgv0C4Qes9qKigjXzTd98/p8Hx20xJmOXSjT5Wtw2XS+fukJ6O vdmiHpN04gTgTqFGaSj38Qyi+eKbrtCciERd0T5bszr33rEyYwbY4w6JbCV7l870XTYVogULC0wbr Xp38FWD1btGOUtFmN5GeQEE/+sPuFFeL0eCEhDK9ZSO36P2diIPCVSdpgK6YhuylTRGXzb8ipo+Nb hflOsl8KmeYDKmgHlYnA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og66g-00EnUy-Oc; Wed, 05 Oct 2022 15:14:47 +0000 Received: from mail-io1-xd33.google.com ([2607:f8b0:4864:20::d33]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65T-00En0D-2a for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:32 +0000 Received: by mail-io1-xd33.google.com with SMTP id d196so2583856iof.11 for ; Wed, 05 Oct 2022 08:13:31 -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 :message-id:reply-to; bh=YFWE05cUP5gYPfL1GvHSDjJECfaamqkGSDdNhylsilI=; b=B3IfNLsvsg49CN/wcewBNkYxeo3e9Yd1ztaNt8ePL3fL9ppDy2MViye0k3iCRSY4ta Chfqqu+E7YvyIVnyV+aIZK7yi88YQRXcmKzNaAhB0/ROUJTnek1U8p2RRm5himfm/5BE Rav9mtztU4Rr8TS86chLRD5YfkTWds2OLXegY= 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=YFWE05cUP5gYPfL1GvHSDjJECfaamqkGSDdNhylsilI=; b=AsEhs3HX5qSLUn+eNPRgmJyOU7WHSSaJiuOVPSWEcw8DiMGd7ZgcdVTCjvn1jKyuSo 0a+kzLu8314QA46O9RfECKpp0VMgg+rVoaaWNgcz1YHMAvXYGjrraZH46DTjkEGb1yQW BWwQOlhROldhyTonZvV3rlxi7mrD5HsVj1bViEHOgY/mPzo3Y+ENSiC7B7YZII92MOtU cLD3iLdUKng7jsZnY8vtk/XfEvI9qibvJdmeLC/6SddgV+Mat58vNUcHv0HKJujdVtc2 PwCV4Tc90Yk7oqqz4kbvLB7aRtRpyJApfKfsAbkUazTxhpFE/mfX6sHlt/pNxmGfD1K3 5xvw== X-Gm-Message-State: ACrzQf103winxqXl4/S5P4eaNVuZfncgArGUzf6tJe09hi8BJxyFFwv3 4yGtC3SVTLTtcEnJ9dhtmUaS7g== X-Google-Smtp-Source: AMsMyM56nOgg3npDfw5C65a4QIZJHPRv3L1xY9cAcrkxpcnDt/dgZvzI9Eq+OObzrzK1lJLpUZsMhQ== X-Received: by 2002:a05:6602:121c:b0:6a5:1f4:4ab with SMTP id y28-20020a056602121c00b006a501f404abmr147259iot.187.1664982810375; Wed, 05 Oct 2022 08:13:30 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.28 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13: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 Subject: [PATCH v7 06/10] drm: bridge: samsung-dsim: Add platform PLL_P (PMS_P) offset Date: Wed, 5 Oct 2022 20:43:05 +0530 Message-Id: <20221005151309.7278-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081331_166366_04320C83 X-CRM114-Status: GOOD ( 18.03 ) 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 v7, 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 Reviewed-by: Marek Vasut --- 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 b46346232c52..41970e794a7c 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 Wed Oct 5 15:13:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999355 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 065A8C433F5 for ; Wed, 5 Oct 2022 15:16:22 +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=VSaEoWXzikG89TNf057fsdUjmV3oQWtoVcmMB/PcloU=; b=OWA7aZWkoYlmmd FHRgCrJFf1shTbAjE3glAM9MeZ0E3ccUN+04uUR4+3XUU4EGa04c4LxQaZFNbNfnlXQ0EDz7Ps2fQ tlmUsLppAcLANDuMEA/wm/yGcVgtdZ7iieZ/Pm/L1oH1i05eEFy+J8ya3ZAZGp6IJWK3GCrQgW/cH lcXCwRib3Y22Xl3+7mBhyJs4Bp4vk1FRqo4z+rpPPWVKW0QMXfpsDukqsTVKQg0VhnqHPQwVkCUi2 ZrJyut1LyYN/TtYEjfPzcLKwnC+/rjnhvduvcBvUCaZ8X4rA+zCTI+twydHCVcMewa0aVv94KtDe7 YDuCJxCzI3QaMVkBI8oA==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og675-00Engz-5K; Wed, 05 Oct 2022 15:15:12 +0000 Received: from mail-io1-xd34.google.com ([2607:f8b0:4864:20::d34]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65U-00EmxJ-SK for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:34 +0000 Received: by mail-io1-xd34.google.com with SMTP id o65so2971466iof.4 for ; Wed, 05 Oct 2022 08:13:32 -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 :message-id:reply-to; bh=eqWkyv52rZKBGpE2JLSJud8lD9bHv8P4xkrBjD3bCbk=; b=He75xA4RM16aQ5VAKk2CxqvdI6pjsnu6+UFugHC57bxnpdSBZt2BZTLIu2O3FPz2pu yCc0p0nYVT3e6OoodzV/XLO1lLZq7lRX591XhdSRI75kLXWmrnt4tlojEGqT9dIsLem0 s84PEvsF3VrcORLzi4eIq1F3/j92Tvgd8EWbo= 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=eqWkyv52rZKBGpE2JLSJud8lD9bHv8P4xkrBjD3bCbk=; b=3Up+jKeHIh8go+HIKgXapufcZ4OEag9Heu40eXlBr58BEjqD74VdZmUETsqXCD/c3O gdJEHpAkq+mmapcjPCZh1aaJ8QsASvqdp/ecor9vLcDZUqT+6dqyafrx83GG4m05OWMZ piYwt5UD6ecRVaKjA/5XmD8K8lPRN0gLW6Qqjc0CmMTxhB2cNALpLivcke3FfClh3qfe v2mfSUfkQTGbrR19VcnWLJ5rXtMLv7prZsMhlYo3fj8EMcqE/vNBD76MCNT7WlP1j0R7 gvDojQOUcHvI+u5co0F+zbmOCzG2suhyc7QFK54/RlXvE3Ug2YvxnTsOIyocFowNyGeM b5Jg== X-Gm-Message-State: ACrzQf05TNBKdVaAHo9hQYs+pm8rb/Op1ktORi/3G5yqLhMJOQ4MVvA9 ChiToxsBuFXK4LpabOZJ0ADa9A== X-Google-Smtp-Source: AMsMyM6O969f4KToRThu6eJakGSR2VtKkHVrZVNGmAwLNm1J8v+vxu/NoQb2o63ygSJsjXhrsOXKuQ== X-Received: by 2002:a02:8804:0:b0:35b:7425:82af with SMTP id r4-20020a028804000000b0035b742582afmr52577jai.21.1664982812516; Wed, 05 Oct 2022 08:13:32 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:32 -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 v7 07/10] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts Date: Wed, 5 Oct 2022 20:43:06 +0530 Message-Id: <20221005151309.7278-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081332_950089_D2558FA7 X-CRM114-Status: GOOD ( 15.54 ) 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. v7, 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 41970e794a7c..f714e49c1eab 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 Wed Oct 5 15:13:07 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999356 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 B6894C433F5 for ; Wed, 5 Oct 2022 15:16:40 +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=vhsKOFFJjUrx9dbd+FTs//oooqDhAQFAEUhRucYdA/4=; b=jjh0NJLbvAQqL2 baVwcxfCzYTjulWMv+FJEG65MJQgEALu1Z5bfwyEO89iwvmjL3nakB3F3yNbGeVzs79JRns7bXoiw jsJ6AsyKKnRAqCYKxtqg0Uq13OWpt/U7f1CSeSeGcRQYFIzHMzqsO0iLt+Mb3/NBHUpOfp/r8y/VG kuWtXehpMHmCdXGN9zEOpaOhma4Nu8xrlX7Rg3lNUf15NR9o9avqr+6xsDzC39wIvWqP5Me3Zwiaa 575XDuUFjkYu7RHWUnBfECUxWIOXYtg3ZIJx7Mt6Xwk2vp5jerA6E7TzJAC5fek57WwMoca3sUI5b 0TDVqXQAb/D+4/o+9clQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og67U-00EntB-CC; Wed, 05 Oct 2022 15:15:36 +0000 Received: from mail-io1-xd36.google.com ([2607:f8b0:4864:20::d36]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65Y-00En1a-3h for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:37 +0000 Received: by mail-io1-xd36.google.com with SMTP id y189so11203927iof.5 for ; Wed, 05 Oct 2022 08:13:34 -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 :message-id:reply-to; bh=wWIP+yGy/n2GKp0GScrqMzuD9vwA6F45Gf3P4LmqEGY=; b=PdruZyNn3pDfvsjOn2r6/JOhK9DB97SSe5VBaJCJnuFDSE/9pM3paV7HaNBDmtfJZw j/79XuZttn5HAdQoQSTQn0qOhER4ok/6yDO0ZnBjcJGYD3ewcDRqwZWEHv2XWfeocHMK paAFXtq+lS3SNtIG0lu82xNXlf7MEPh6ixGDk= 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=wWIP+yGy/n2GKp0GScrqMzuD9vwA6F45Gf3P4LmqEGY=; b=MkNqmA9BneJk929A85mj4ik39vNbnxnl5Q3L/Efb/00gxGnd6+3MPcirQJlCbu/iSR UC+CU1IZ4XhlnTSzlgsx43cB0UQ9o7iIf02UE1ze1vRKjQ/VCdxS9tMIlPY6/np3iIZG R5EegJeA6nIfwXzRhH3F+00ynK2BbWj14PsQS+uqab7c1T33YVNpIaiiROXl0A/WQzxl HU1SsqAxsWuN1qx1ihOI9s1lz4WKUwMhYnVc3TS6i+dbjU+898OHEcE5tf1gtnECWWWP iHMq+s/712BxYJbvXGOmFJELXFN0w62sMhyAU5zFStkjJdA1Hzd8wtHb0JOixIQat5hX YXGQ== X-Gm-Message-State: ACrzQf3ZcI/LWosDvCywl8s6JxL6wWD5DM6sKOZ4b4xwTypnKHOoKf66 9R9yVcxGDfTRNgrk435c7gEt0Q== X-Google-Smtp-Source: AMsMyM7plXxDojB4aFrHxdxQ6nlSBFxsxPVUZHWp+3Ju2o16fvFfQ0r75G4f4MR6aUdANqxShuc+LA== X-Received: by 2002:a05:6638:134f:b0:35a:5b6a:9591 with SMTP id u15-20020a056638134f00b0035a5b6a9591mr64725jad.184.1664982814334; Wed, 05 Oct 2022 08:13:34 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.32 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:33 -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 v7 08/10] drm: bridge: samsung-dsim: Add input_bus_flags Date: Wed, 5 Oct 2022 20:43:07 +0530 Message-Id: <20221005151309.7278-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081336_192946_0721B915 X-CRM114-Status: GOOD ( 12.06 ) 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. v7, 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 f714e49c1eab..f5cd80641cea 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 Wed Oct 5 15:13:08 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999381 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 83C2CC433FE for ; Wed, 5 Oct 2022 15:17:13 +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=PhQay/Q9kFdRzaK571C5mIoB9iAylmTQPvBuatla51g=; b=CFxINGhTwCRaUm xSXxUbmdmZBLF68gtBuJeBGs29Fe0hrQxhWKosAVIykMeIU1hO5J+PXXiI0DyfZZScaBNYBq8ju+b 5XK7vzZ5pce+a7la2wXCitcK5Mb1U+TnjqCAU6FFOCW/pi/ngx6H//Ke0JYkkcqY/TEekSxBUWsJA SGp+nvNfs/2ycbj9n3oDUsvdoh+bYA7ZMRdo9dTzgM8VbkVpV2hiZN9zEUVbW+q8zs5N3BuVVluRz 5MLicuHLEakBdDdONkn/WJxUx2/kkoMulrZW9jddqOPZ1lSKHL+cWbF8eMfd7aJ6ItFzQ+ihoA+3J QKTpOoPwUhXT/LnEOHSw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og67s-00Eo4B-QW; Wed, 05 Oct 2022 15:16:01 +0000 Received: from mail-il1-x131.google.com ([2607:f8b0:4864:20::131]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65a-00En2B-2I for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:39 +0000 Received: by mail-il1-x131.google.com with SMTP id r20so5148553ilt.11 for ; Wed, 05 Oct 2022 08:13:36 -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 :message-id:reply-to; bh=1VdDEs1pi0qW/yb3TfGC/umjEjhhqUp9mNuoYTgXucw=; b=kiKQaGYN3sa14/VpVKcELjjC8h3OY40YcBrnv+4pPnYwBcVHuwm1bnXT6lpOH/OgyQ tQrJeBiIz5jk/tA4/pgHKLnHvl6WXfyXyLZRuLD1Em9huvEK5RIZnOG6V2GBoSe+d/Tj /BpjtyIQb7E7y0uKpz0eREWEYLmEjaDDZNuL8= 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=1VdDEs1pi0qW/yb3TfGC/umjEjhhqUp9mNuoYTgXucw=; b=DiJVBcJjGHmFLpzc3hxnfB1o1UbzhMz5kByAZCcbknFvF/IUTwLtBU6Q4j9j7V5Hrj k11BkGVzXlC+LH/QZoPQUv6ZtKb0Ou6WAC5V2TweXSB0xryF6air48eaEenSZyZhExW+ WXcUoV2ZvEJ17YbGtiLErKDrbsqPGodMAKXoGKAYsQlvlOjbpOc3la/yDbu8MzDMf3zC 3vQWhnZXOvupxH9vy20AES3T7kyiL1AIZSwYsxIoWAmAqaNpOzp7HMo63Y630FqY8462 626Dq1ugGnAATUtjc9MArJwWLCmJrDZYBxgStSHcQqfblQirPN7P2ydNTVVxMUHDihqs UY5g== X-Gm-Message-State: ACrzQf0KoBVSNlHFMatn+cnrInq4fmuxYNyW7lFYbT2zIsL2lJsKHlQS IajwJEKK7jXjpThfTcKT1mIopQ== X-Google-Smtp-Source: AMsMyM4PrDXBe+q8y0XRtJ0ZpqAVT+zqc8fvM6mbuz//B9QSOyBbdWRK12W8OMmQpy1/KL/mUp61fA== X-Received: by 2002:a05:6e02:1789:b0:2f6:b741:3e6f with SMTP id y9-20020a056e02178900b002f6b7413e6fmr49909ilu.157.1664982816172; Wed, 05 Oct 2022 08:13:36 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:35 -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 v7 09/10] dt-bindings: display: exynos: dsim: Add NXP i.MX8MM support Date: Wed, 5 Oct 2022 20:43:08 +0530 Message-Id: <20221005151309.7278-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081338_134224_53B8E734 X-CRM114-Status: GOOD ( 11.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 Samsung MIPI DSIM bridge can also be found in i.MX8MM SoC. Add dt-bingings for it. v7, 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 Wed Oct 5 15:13:09 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 12999382 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 075F5C433F5 for ; Wed, 5 Oct 2022 15:17:36 +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=ys0jXhxYxysj6dQvMbJXDrp+fldmItqVl75jesN8nLg=; b=c2RImAx546qHxi EXvsbZ7ay7uwA0LDyAjyXFqiodfKp5OMrYwwHNUhOdJxsLdxOxGlk+6GU3awiV5ZF1h34Lu92O0VC R7Eew+PqiAy/FX3opKI3O2R15RRIoigtGcV3Mg71PR5QRAlBw6epxX0IybU5EJTDNYEQ9XTZbqr1H veEP6qwbrGL47skajOmDYnwAUr+ieef6wyx/wEht95Djv6ZwsB1FU9/zECkPJjLgMTz05kD85djGd naztwvU33QMTVrT6wCpNhRbOPJyz0ex7R9pwODUHVqyosRkh2Aavd1ppeQapsy2IsXpcH126WA8Yo OXADn3ITWkMZSact6xRQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1og68H-00EoEN-C2; Wed, 05 Oct 2022 15:16:26 +0000 Received: from mail-il1-x132.google.com ([2607:f8b0:4864:20::132]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1og65c-00En37-5H for linux-arm-kernel@lists.infradead.org; Wed, 05 Oct 2022 15:13:41 +0000 Received: by mail-il1-x132.google.com with SMTP id u10so6606191ilm.5 for ; Wed, 05 Oct 2022 08:13:38 -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 :message-id:reply-to; bh=preYEoQg0LX6lD/WAOwpnKfSNDR1YFRVxD4DlRUGkd4=; b=lxNqiUpWYwCzyY2rJLZPtx7MQ6XjmBozOxRmtaNiKq4ZF/8LQ/sbBLoQv8PLfIWOse ncrXZwGBfewOOmJQBmZZRN5vw1u7vCa20uUIualOqoFcK0ccM4/Qj8Erce0bQIjIAoHD Orqd1Je0BjwyzxfYEZLlbJ1pdeT9/yiRDHik8= 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=preYEoQg0LX6lD/WAOwpnKfSNDR1YFRVxD4DlRUGkd4=; b=VSd4UqB2ICCgTgfVOFyMMng4Yrh4T+KVIr+NnSJXRuWzYvuq8s5fLGQEEkDlE6/6P8 AnJ6XUoeCYBD8SNaLueujLWoy+VU+vEd65wuIbqHz1YMoVLS7FUoQAnJeNJENIMG4USn 5YEQiNzKAveidKGurXXSvd10+/N6Fhk3CV7qBStjoVku/94u9g3sx4rV3EsPTIzYlZSO SsnMNyD9BLv5yuH3IFpGkNf71CpuTT6zx3B2QmePJGU4UvYrAK9nmfFWIGHOhLlSa/Az gFnj8ZIGDKFPdwHbwwu9eBd55P6UeqjarO6DyQeuMUj9GQF5w1BOiLQ1C+eb8x1sXIiV 6MpA== X-Gm-Message-State: ACrzQf2vHXAUefndMsoA/3ee0+/my6gA8hYSaHkGfGEWm6+FPPwI1waL h8s1OZVD5vNXs6utrrHRTs0ZQQ== X-Google-Smtp-Source: AMsMyM7oQxHYFC9wRtMAvjgY+dEp/T158CKlsL2Re02oXE+MskDsyE5N3YAx/UTZP+BdSW4bw65mJQ== X-Received: by 2002:a05:6e02:1c86:b0:2f9:7dc5:4037 with SMTP id w6-20020a056e021c8600b002f97dc54037mr72663ill.2.1664982818128; Wed, 05 Oct 2022 08:13:38 -0700 (PDT) Received: from j-ThinkPad-E14-Gen-2.stthomas.edu ([140.209.96.21]) by smtp.gmail.com with ESMTPSA id w15-20020a056602034f00b0068a235db030sm7089276iou.27.2022.10.05.08.13.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 05 Oct 2022 08:13:37 -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 v7 10/10] drm: bridge: samsung-dsim: Add i.MX8MM support Date: Wed, 5 Oct 2022 20:43:09 +0530 Message-Id: <20221005151309.7278-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221005151309.7278-1-jagan@amarulasolutions.com> References: <20221005151309.7278-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20221005_081340_234175_E5619892 X-CRM114-Status: GOOD ( 14.66 ) 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. v7, 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 f5cd80641cea..1b5ba33dc635 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);