From patchwork Mon Aug 29 18:40:20 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601426 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id C81E4ECAAD5 for ; Mon, 29 Aug 2022 18:41:05 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229540AbiH2SlF (ORCPT ); Mon, 29 Aug 2022 14:41:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59188 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229446AbiH2SlD (ORCPT ); Mon, 29 Aug 2022 14:41:03 -0400 Received: from mail-pf1-x435.google.com (mail-pf1-x435.google.com [IPv6:2607:f8b0:4864:20::435]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0952B7F0B4 for ; Mon, 29 Aug 2022 11:41:03 -0700 (PDT) Received: by mail-pf1-x435.google.com with SMTP id 145so8689462pfw.4 for ; Mon, 29 Aug 2022 11:41: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; bh=P8VFeEM/BFJI467dCNlhyUmXQlADynuLsgzoWk47wCg=; b=EPSFr67+xfTIyGBIh3RYgbAX5fNxJaVR6R4ntWQPcH3goFHbRgOpUTUkozy0PyqKZQ tWUTihCpY0hC4P8R/uimrljrbbklIXgyvl9PBBh+xn73amdL/ko7cBn8seP9Xdh4fzFO CN0iAuNlqPllYtuV4HfqBaBP7P2pxnhBzqWQ4= 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; bh=P8VFeEM/BFJI467dCNlhyUmXQlADynuLsgzoWk47wCg=; b=E4brd/aUXnfVfrnSA+3Guxmu9jPlZSvl3sIyj+vZDu4xvD9N8Q5rCL0x936b6yFAkp S+NdGjWrOmyvumrGYKXWRgVAvFysYON02MeJt0P4VmHAOa4gkLAH7f1ypgdccQwAMLUm /fMGpW7uHbZGyM6Af7d1z4rc6GBpVaj4O6gFh8LUonl3FvjCa3cbQpMOgdISL+Rj63zJ SwYnki4V1ZG9/WrDjIbKERZX+aGP/4n25nIrTUcyspSABngdXRjOX0dZc5ZbK/QZtzo1 xaziko+YNacjC+I2SsruCJtL+yd/68e8b8yKLqC4ZnVS+fACln7HLmzX0cZEfp3/IQfB chvA== X-Gm-Message-State: ACgBeo0Ejv6kz+l5HG+wlg5L+ju9n3kLpjm8Y0Bo5foGBqgQPtIs4BkS WczFpJW7VWBYNlavDJJ++1u0vw== X-Google-Smtp-Source: AA6agR6PuGUOWRB54FiVXcq+DeYxGBCJLzqGuDD46zbx+u/8z/espw13ja8BVRylsZBCfn1YgyGaPQ== X-Received: by 2002:a63:1921:0:b0:42b:6eb3:bce5 with SMTP id z33-20020a631921000000b0042b6eb3bce5mr15304041pgl.231.1661798462536; Mon, 29 Aug 2022 11:41:02 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.40.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41: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 v4 01/12] drm: exynos: dsi: Restore proper bridge chain order Date: Tue, 30 Aug 2022 00:10:20 +0530 Message-Id: <20220829184031.1863663-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org From: Marek Szyprowski Restore the proper bridge chain by finding the previous bridge in the chain instead of passing NULL. This establishes a proper bridge chain while attaching downstream bridges. v4: * none v3: * new patch Signed-off-by: Marek Szyprowski Signed-off-by: Jagan Teki --- drivers/gpu/drm/exynos/exynos_drm_dsi.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index ec673223d6b7..e5b1540c4ae4 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1428,7 +1428,8 @@ static int exynos_dsi_attach(struct drm_bridge *bridge, { struct exynos_dsi *dsi = bridge_to_dsi(bridge); - return drm_bridge_attach(bridge->encoder, dsi->out_bridge, NULL, flags); + return drm_bridge_attach(bridge->encoder, dsi->out_bridge, bridge, + flags); } static const struct drm_bridge_funcs exynos_dsi_bridge_funcs = { @@ -1474,7 +1475,10 @@ static int exynos_dsi_host_attach(struct mipi_dsi_host *host, drm_bridge_add(&dsi->bridge); - drm_bridge_attach(encoder, &dsi->bridge, NULL, 0); + drm_bridge_attach(encoder, &dsi->bridge, + list_first_entry_or_null(&encoder->bridge_chain, + struct drm_bridge, + chain_node), 0); /* * This is a temporary solution and should be made by more generic way. From patchwork Mon Aug 29 18:40:22 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601066 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id E9CDEECAAD2 for ; Mon, 29 Aug 2022 18:41:19 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229446AbiH2SlT (ORCPT ); Mon, 29 Aug 2022 14:41:19 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59226 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbiH2SlR (ORCPT ); Mon, 29 Aug 2022 14:41:17 -0400 Received: from mail-pj1-x102a.google.com (mail-pj1-x102a.google.com [IPv6:2607:f8b0:4864:20::102a]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0BC8A7F0B4 for ; Mon, 29 Aug 2022 11:41:17 -0700 (PDT) Received: by mail-pj1-x102a.google.com with SMTP id m10-20020a17090a730a00b001fa986fd8eeso15574476pjk.0 for ; Mon, 29 Aug 2022 11:41:17 -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; bh=V9K+I20QaNq4O5Ra7YlAgpXXseteLWhgORIY+myzuBs=; b=ornPFx88Hc3KxbFSN8rDnQptppeQGh6Q7FqKlH60GpmuLXnO6iJ4hYAn0e3+IxO9yq CRIYZ6CdazpE2la1L91GzJF5js/DrF8awehRmtH2Ds36jtk4vl/EIsPPQ0pGYOqHMsIm BnmCePHhicKjc9V67CaurSuWwxvA1vS6M3uAA= 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; bh=V9K+I20QaNq4O5Ra7YlAgpXXseteLWhgORIY+myzuBs=; b=GZ+vuykY7K+J595pTtsfzARrHclgyi4CL8+2Njz3Uj8qeXMsKcR4QaWvw2qn+s2KqD fzc6aunn2wNmlx57Dayh6mJpIYhyqKKDelGese83uDQX8VyP2MOGuU7YaJfURq8rPEf8 Odb0z/vHSFuUFiFrbRrxuyztwNFW+wlOra3hr65BqybIoEPljBD2WMHp4vZEHPxM5Boz TGa47bffGTOu05JmAKaUs8JHOGBGMeYobIHGixw87tiSXyXILNOJeJvj99ZdKOdFwVro +zuolp2DpBEvo8HF8whlL/FlakkkiubamBovr1Ifqaz2+HbaHtwjy5oI9rIrcDkFdPRF /3xQ== X-Gm-Message-State: ACgBeo0SIbqwMgM5cTLm8Lu/gwBJFKjHVfJWIb/m95jmPyy0f7ClTCls 8/HfIZ9uwhrSDpDHvLw+O0Gm9g== X-Google-Smtp-Source: AA6agR6kwjgKG7jQbJjeT1oa/zfUjHoKziT4vv3E/X3mf9UBam5tcGdOKDGpOwEFvNbvebl8ScyNuQ== X-Received: by 2002:a17:902:f68d:b0:16f:2314:7484 with SMTP id l13-20020a170902f68d00b0016f23147484mr17308520plg.136.1661798476471; Mon, 29 Aug 2022 11:41:16 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:16 -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 v4 03/12] drm: bridge: samsung-dsim: Lookup OF-graph or Child node devices Date: Tue, 30 Aug 2022 00:10:22 +0530 Message-Id: <20220829184031.1863663-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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. 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 ab2fa0f42f40..8130845750ac 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1357,18 +1357,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 Mon Aug 29 18:40:23 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601425 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8FA29ECAAD5 for ; Mon, 29 Aug 2022 18:41:29 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229646AbiH2Sl2 (ORCPT ); Mon, 29 Aug 2022 14:41:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59346 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229590AbiH2Sl1 (ORCPT ); Mon, 29 Aug 2022 14:41:27 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4A14380EA8 for ; Mon, 29 Aug 2022 11:41:24 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id h13-20020a17090a648d00b001fdb9003787so4143099pjj.4 for ; Mon, 29 Aug 2022 11:41: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; bh=PPlEiJ1s7VViC3D9HvOY78/ATyLjYX2n1j74zd4YcKk=; b=QhLJ26UKWuluZfQdk2QtTP/ylCjGaEfAvCSyKojFJah7jSAQzU1r0fOM0wwqIoTz4p qgSIew4UizYRkAW6QT/fbhSo3SzpbwVDA1ruqI6zIUz/T9TTIatvdSBd073EOlUZV4Eo DRkj4pMqHCOyyeEtGUYEJoMCeEkSUuKo8sznY= 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; bh=PPlEiJ1s7VViC3D9HvOY78/ATyLjYX2n1j74zd4YcKk=; b=L0g0/CjBlanq1BYQ2DdapFBxTd78jFC5uJIA3t1ARjNgUE7GRTUfWOKh13z25pVHyJ jwX27l7MhEXHJUj8/Q0bxt7vlWtCQv/VeDkQBIR7Gsi0wZh4B7U+AgFW2IBcYO1xX3Kp JcFYJhaIDu35FYmh1WruSLbPPPJZdl5wUr5xqVMpIcQJTm+IwCb0Fc6QBwjkO7D8omsc y4zAeMfs6YdPNPg9ELdDBzOA2Vd4UThHYbtiEEXgljvN9fM82sTubnOi0xvOA/IPW0qM oQNomSXJjKucjHKBRrVu6jA0snl4vBdxSrcHb8FAk+BK45sk/KU0ikcXM97Egk4Tcy5l d76w== X-Gm-Message-State: ACgBeo2X3F/Txu2u6RNWoPWxlmbuScChxxijxqO6zwRVFRj3mBHFugB8 XRhl5Bk+r3ZqZROziEs9I86iMw== X-Google-Smtp-Source: AA6agR6vTqim2hlf9fZI6ItfjbP5zs3H1cmu5kV+ibwJP7DhviVYcQ0aOB9pCO7sJpJMBJKgwW6xRA== X-Received: by 2002:a17:90b:2c12:b0:1fd:78fa:5ea7 with SMTP id rv18-20020a17090b2c1200b001fd78fa5ea7mr16325155pjb.29.1661798482992; Mon, 29 Aug 2022 11:41:22 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.16 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41: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 v4 04/12] drm: bridge: samsung-dsim: Handle platform init via driver_data Date: Tue, 30 Aug 2022 00:10:23 +0530 Message-Id: <20220829184031.1863663-5-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org In order to make a common Samsung DSIM bridge driver some platform specific glue code needs to maintain separately as it is hard to maintain platform specific glue and conventional component_ops on the drm bridge drivers side. This patch is trying to support that glue code initialization based on the DSIM_QUIRK_PLAT_DATA set from respective driver_data. So, the platforms which enable DSIM_QUIRK_PLAT_DATA flags will handle all platform specific initialization via samsung_dsim_plat_probe. The platform probe is responsible to - initialize samsung_dsim_plat_data and install hooks - initialize component_ops - preserve samsung_dsim structure pointer v4: * none v3: * update samsung_dsim_plat_probe return value * add plat_data quirk to handle platform init v2: * fix samsung_dsim_plat_probe return pointer v1: * use platform_init instead of exynos_specific * handle component_ops in glue code Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 16 ++++++++++++++-- include/drm/bridge/samsung-dsim.h | 5 +++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 8130845750ac..76dc7687857a 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -369,6 +369,7 @@ static const struct samsung_dsim_driver_data exynos3_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { @@ -381,6 +382,7 @@ static const struct samsung_dsim_driver_data exynos4_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { @@ -391,6 +393,7 @@ static const struct samsung_dsim_driver_data exynos5_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 11, .reg_values = reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { @@ -402,6 +405,7 @@ static const struct samsung_dsim_driver_data exynos5433_dsi_driver_data = { .wait_for_reset = 0, .num_bits_resol = 12, .reg_values = exynos5433_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { @@ -413,6 +417,7 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .wait_for_reset = 1, .num_bits_resol = 12, .reg_values = exynos5422_reg_values, + .quirks = DSIM_QUIRK_PLAT_DATA, }; static const struct of_device_id samsung_dsim_of_match[] = { @@ -1609,7 +1614,11 @@ static int samsung_dsim_probe(struct platform_device *pdev) dsi->bridge.of_node = dev->of_node; dsi->bridge.type = DRM_MODE_CONNECTOR_DSI; - ret = samsung_dsim_plat_probe(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + ret = samsung_dsim_plat_probe(dsi); + else + ret = mipi_dsi_host_register(&dsi->dsi_host); + if (ret) goto err_disable_runtime; @@ -1627,7 +1636,10 @@ static int samsung_dsim_remove(struct platform_device *pdev) pm_runtime_disable(&pdev->dev); - samsung_dsim_plat_remove(dsi); + if (dsi->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) + samsung_dsim_plat_remove(dsi); + else + mipi_dsi_host_unregister(&dsi->dsi_host); return 0; } diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 2e245bffd1b6..97fdee5ef5df 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -33,6 +33,10 @@ struct samsung_dsim_transfer { u16 rx_done; }; +enum samsung_dsim_quirks { + DSIM_QUIRK_PLAT_DATA = BIT(0), +}; + struct samsung_dsim_driver_data { const unsigned int *reg_ofs; unsigned int plltmr_reg; @@ -43,6 +47,7 @@ struct samsung_dsim_driver_data { unsigned int wait_for_reset; unsigned int num_bits_resol; const unsigned int *reg_values; + enum samsung_dsim_quirks quirks; }; struct samsung_dsim_host_ops { From patchwork Mon Aug 29 18:40:24 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601065 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7C529ECAAD5 for ; Mon, 29 Aug 2022 18:41:33 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229717AbiH2Slc (ORCPT ); Mon, 29 Aug 2022 14:41:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59414 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229671AbiH2Slb (ORCPT ); Mon, 29 Aug 2022 14:41:31 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 2A2987FE70 for ; Mon, 29 Aug 2022 11:41:30 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id u9-20020a17090a1f0900b001fde6477464so2440190pja.4 for ; Mon, 29 Aug 2022 11:41: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; bh=ekS3WKj8dCgDC2uR7us15QLNPxhzQvukxO9+hGPd1Fc=; b=HnbXs1ML66kxEnNABMLGgQzYP9+Mx/9aOdoFNZOeNZP13+7t3gxkTo9aHFnit/8p39 +qJrpHfU9ORiAamjeK1hjEi1aOXZGWXm7A/PL0QgDh4+rKFXEO8F3+duantPVOt6Vhrm CaEwNKBHjHmNuOKWMMxL9DPkxrePRVG8yX7ac= 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; bh=ekS3WKj8dCgDC2uR7us15QLNPxhzQvukxO9+hGPd1Fc=; b=j4PzlVzy16oUI+oI20qQnA3RTLtTnQv9BnnpDmgRA7+iM5sNNeTG8SdeRwSsGhi6ep LcfdoUmJoRKV7rQ1ghhE/Y1+X545ujN8fHuUKmi5NAJed2L1b8Phcs7iU20Si9S0Y3xe Q2WY8AT4qZaHHHu5muUOJAMsahfLChys/gPYr4yPAwTYqxN9YLR6TE+Y3uUpJfqf9f9f pPIAkEP+BMDc10wNbEz4wmgx+zCiGqbpGg+W1itywbhuqaTMMWdGBMeaiEHFsVAYJv2X 3fAZ66KhE58ZuA/Tr8poy9upSvJv3hGqVEqRJTFUjKZfOIwh1ErAWd00few5XayfEVly KBpg== X-Gm-Message-State: ACgBeo1Vnq6U7x6RUqjb+P7CL1Mt1PBqekB5vco12XpDSdLiZd2/KbL0 C3amFRZ63BrAiGcrkpZLvuJJjw== X-Google-Smtp-Source: AA6agR6igcVBbT/LUR6Sd+1DiAgFRJV3DTmCSHTSH2MW//x0unKs5bFAKtczc3KvcelUDCNwOwqItQ== X-Received: by 2002:a17:903:4043:b0:174:dd99:a589 with SMTP id n3-20020a170903404300b00174dd99a589mr4510335pla.56.1661798489606; Mon, 29 Aug 2022 11:41:29 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.23 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41: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 v4 05/12] drm: bridge: samsung-dsim: Mark PHY as optional Date: Tue, 30 Aug 2022 00:10:24 +0530 Message-Id: <20220829184031.1863663-6-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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. 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 76dc7687857a..c3ed317996ad 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1583,7 +1583,7 @@ static 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 Mon Aug 29 18:40:25 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601424 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9AD3DECAAD8 for ; Mon, 29 Aug 2022 18:41:42 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229748AbiH2Sll (ORCPT ); Mon, 29 Aug 2022 14:41:41 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59680 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229801AbiH2Sli (ORCPT ); Mon, 29 Aug 2022 14:41:38 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9A38F82853 for ; Mon, 29 Aug 2022 11:41:36 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id q63so8457439pga.9 for ; Mon, 29 Aug 2022 11:41: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; bh=NcL003R2tcMcOwfD3XXeYJO2gKUt8M4GWo/KhiYrw5A=; b=MkUC+YddbA+CuXicH9qNVeR6NFVmRweFrgCteSsRAd4yxMo+yQgaZOGLeIzEENVKp1 lgXjFqn3Xjp7ZJaD45dzK4hM2mpsz4Cl7VYkKlGaJvYEKQxb8xmA/zfFG6+4PwD0RYYA w2P3VFbgRrh4pP0TgWmUbTVx4kudUI9TcKmBQ= 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; bh=NcL003R2tcMcOwfD3XXeYJO2gKUt8M4GWo/KhiYrw5A=; b=RXZWND/mD8TxG2y95Zss/Cngnxr5aTQJkYZ+cjrpaampTNQcEduHd8/5aX7BxnW10V oCnAPEHLSyagTrgd1bY7ET5xuJCF4bQwMzubPrJd4IUFXUS9BKReTOb5KbecSVfkx9P/ LwdXJ6UyG2p2LNzGsU/jAe40OxEBzEzJxOI/FMuD5BHGl27vFGmMdyafXrC0hvQpnKyU Kd9vYBQHhBxXTC55CF3xQk4qtzrWKTQxYSnEl7vI6nOKicYv11bwyPcfu8yki1KPOIof 14tDapBEMv+cTUU0NGT3X9fwnNeak65e3BRgUABHgPC2NldkAhz00a8HmzPhjTsYTPBS B/bQ== X-Gm-Message-State: ACgBeo3xft6GXau3iJ5U4dWRJCiOz3bTTVE/EvF/fe9kDS8zaE4hu7uW fMRNJfixLjqEUILBV1o3paOhMA== X-Google-Smtp-Source: AA6agR6NvQGweB0dFOJY66b2WnvBKTilarlmcAVuA+VEHO2Ac6KZ15fZfqgacIx0WQsyu8V26SD3ng== X-Received: by 2002:a63:5246:0:b0:42b:e4a5:7252 with SMTP id s6-20020a635246000000b0042be4a57252mr6772119pgl.566.1661798496014; Mon, 29 Aug 2022 11:41:36 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41: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 Subject: [PATCH v4 06/12] drm: bridge: samsung-dsim: Handle proper DSI host initialization Date: Tue, 30 Aug 2022 00:10:25 +0530 Message-Id: <20220829184031.1863663-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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). 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 c3ed317996ad..b6883a6d4681 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1254,12 +1254,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); @@ -1270,6 +1275,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; } @@ -1289,6 +1296,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, @@ -1464,12 +1475,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) @@ -1654,6 +1662,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 97fdee5ef5df..e15fbfd49efe 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) struct samsung_dsim_transfer { struct list_head list; From patchwork Mon Aug 29 18:40:26 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601064 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 92050ECAAD8 for ; Mon, 29 Aug 2022 18:41:46 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229543AbiH2Slp (ORCPT ); Mon, 29 Aug 2022 14:41:45 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59868 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiH2Slo (ORCPT ); Mon, 29 Aug 2022 14:41:44 -0400 Received: from mail-pj1-x1030.google.com (mail-pj1-x1030.google.com [IPv6:2607:f8b0:4864:20::1030]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E0C1D81B1E for ; Mon, 29 Aug 2022 11:41:42 -0700 (PDT) Received: by mail-pj1-x1030.google.com with SMTP id h13-20020a17090a648d00b001fdb9003787so4144285pjj.4 for ; Mon, 29 Aug 2022 11:41:42 -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; bh=xMi0yFur/nA6QX+prP8Y5QXRtVTqBYGjaNwK4RB7jg8=; b=KLyBqgHkI7olBo1slJB6ivJuI0v0vR5rxy+Ndw2IV08ufTafgqjU+hf8M4Y89SS9bh FhwFWrQ1DYBK1zLCkUY6pQ7IOxPDKCY8xkLlKdi0nA5y4Pl9dKO3P5djTV7EgJT7iToL OFKtzEISGSPMCCmXuStBXaF1EJoK4XuAOP6Ss= 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; bh=xMi0yFur/nA6QX+prP8Y5QXRtVTqBYGjaNwK4RB7jg8=; b=wMN04xPCsgP2MXbjryGg03ngN/X8wQuFFiU9zOS+B2sfsgilnyPsuDOs81Ap3s373w BIpS4wIrg0nm6J3nY9ZaIIzF7npSg/2MDo3WLr/7wQ+R5lYiquUZzqE2gGczhAYSVfK5 o3wHiPbJaxDjCcCdlc3PHe97u9+uXRtFWXCagjYNz3pSJYCSrJp3a2UKcjePfLnJmDKF S/fqniPwn6EXzBMrlwbj75UGrP6E0bymSVcLuNbi5QDB7dpWfvS+aKOsBxgUtQshWnKf JkHQOEPyLBVBHKW0KS7AviyNtj/itOGZh9VyCnP3fo5fWsn18XaaLPqDqJbk7A00fxvI NtIw== X-Gm-Message-State: ACgBeo0GZGQV/T3mknd/b6ODUodrkHe9UAMQ84Y0URt2yn1SPatYjC7o GsKwxZdpfA4w8Og+a393fxH2dA== X-Google-Smtp-Source: AA6agR50WyCEtnMzshtbiOgRs+nYGM/4K9LXvfKjn77kyzgG+REX32KR/OiaDOzROGBS63pdkPvZ7Q== X-Received: by 2002:a17:902:dac8:b0:174:cf17:6e87 with SMTP id q8-20020a170902dac800b00174cf176e87mr5795736plx.129.1661798502540; Mon, 29 Aug 2022 11:41:42 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.36 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41: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 v4 07/12] drm: bridge: samsung-dsim: Fix PLL_P (PMS_P) offset Date: Tue, 30 Aug 2022 00:10:26 +0530 Message-Id: <20220829184031.1863663-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org The i.MX 8M Mini Applications Processor Reference Manual, Rev. 3, 11/2020 with 13.7.10.1 Master PLL PMS Value setting Register mentioned PMS_P offset range from BIT[18-13] and the upstream driver is using the same offset. However, offset 13 is not working on i.MX8M Mini platforms but downstream NXP driver is using 14 [1] and it is working with i.MX8M Mini SoC. Not sure about whether it is reference manual documentation or something else but this patch trusts the downstream code and fixes the PLL_P offset. [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#n211 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 b6883a6d4681..b6d17c0c9e58 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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -381,6 +382,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -392,6 +394,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -404,6 +407,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -416,6 +420,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, .quirks = DSIM_QUIRK_PLAT_DATA, }; @@ -563,7 +568,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 e15fbfd49efe..95d3f89aec4f 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -47,6 +47,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; enum samsung_dsim_quirks quirks; }; From patchwork Mon Aug 29 18:40:27 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601423 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 56674ECAAD2 for ; Mon, 29 Aug 2022 18:41:53 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229757AbiH2Slv (ORCPT ); Mon, 29 Aug 2022 14:41:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59938 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiH2Slv (ORCPT ); Mon, 29 Aug 2022 14:41:51 -0400 Received: from mail-pg1-x52d.google.com (mail-pg1-x52d.google.com [IPv6:2607:f8b0:4864:20::52d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 4F8B6796A4 for ; Mon, 29 Aug 2022 11:41:50 -0700 (PDT) Received: by mail-pg1-x52d.google.com with SMTP id 69so6822317pgb.13 for ; Mon, 29 Aug 2022 11:41:50 -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; bh=afY7o/rHKgz7bPVIsHlJqcMLg2zdE5JP0LSEIlSKELQ=; b=JthEQfkDp2ABcDuxrRsvwoddsnZLE0yPqwolJ+UPL8WSTwFSNNuUhMzVF0nS5eaeVE IeCrbBNw3R4IDD4K4RKYUK/QZEnA301uttbST6v+Z1N6WGWepxXzLC11DJi3KIhKcCe3 PMzzLbTl96muRDCgU3470fzLXaZ7dZT9/zm3c= 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; bh=afY7o/rHKgz7bPVIsHlJqcMLg2zdE5JP0LSEIlSKELQ=; b=CsUTnulXUODZAO5HVxJ4Rb1XeJdSHYNnW8DOs2G3CQQDHLaB5iu1M+A7gxPGVXLD/e 7mdHeQQucTQzpZxpxxgfZ40Chg2CALRLa1RFHtOnX8eG0DxgAjlu8fafH1qtKfO0rNVz Mc9vQXxGfNIHzsTOmCJm8NUEycOEiMA5pLDY9GTUpLIkVDDC+IgrXbvNr213m3AcPRA2 +vJRcfBTRzJxLoNUsYJEJbVIGXK4+qGe/P750RiDI4PRX5OidsPqsuqYwG8JnoK+3pwQ r8A3mh3JD4wczpLxYRj7qTojrtnv5EH3Xtb2ze3OrDycVcryBtM9UtDyvCETAJNPvsUR wy0A== X-Gm-Message-State: ACgBeo2u/orF/ZOGDA1wlYo3HB0x6rT0KrhZLrU+0dIUPMaTPnBL4EXc LvGstUa01SQf2HwJT1urp7Hdhg== X-Google-Smtp-Source: AA6agR7vR8D0gPZzURPe+HswcUsv8K/EkuxcpFdoEdqxg/fBz2u8El8K1GZwkA3MHP+sElvn5rWtCQ== X-Received: by 2002:a63:215a:0:b0:42c:7687:7315 with SMTP id s26-20020a63215a000000b0042c76877315mr1539387pgm.289.1661798509818; Mon, 29 Aug 2022 11:41:49 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.42 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:49 -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 v4 08/12] drm: bridge: samsung-dsim: Add atomic_check Date: Tue, 30 Aug 2022 00:10:27 +0530 Message-Id: <20220829184031.1863663-9-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Explicit fixing up of mode_flags is required for DSIM present in i.MX8M SoC. 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. So, add DSIM_QUIRK_FIXUP_SYNC_POL to handle this fixup via bridge atomic_check. 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 | 18 ++++++++++++++++++ include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 19 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index b6d17c0c9e58..724fd76435c6 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1341,6 +1341,23 @@ 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->driver_data->quirks & DSIM_QUIRK_FIXUP_SYNC_POL) { + /* At least LCDIF + DSIM needs active low sync */ + 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) @@ -1363,6 +1380,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, diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index 95d3f89aec4f..62e1078f43cc 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -36,6 +36,7 @@ struct samsung_dsim_transfer { enum samsung_dsim_quirks { DSIM_QUIRK_PLAT_DATA = BIT(0), + DSIM_QUIRK_FIXUP_SYNC_POL = BIT(1), }; struct samsung_dsim_driver_data { From patchwork Mon Aug 29 18:40:28 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601063 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3D101ECAAD5 for ; Mon, 29 Aug 2022 18:42:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229783AbiH2SmA (ORCPT ); Mon, 29 Aug 2022 14:42:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59990 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229751AbiH2Sl7 (ORCPT ); Mon, 29 Aug 2022 14:41:59 -0400 Received: from mail-pl1-x62f.google.com (mail-pl1-x62f.google.com [IPv6:2607:f8b0:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E416580F5A for ; Mon, 29 Aug 2022 11:41:57 -0700 (PDT) Received: by mail-pl1-x62f.google.com with SMTP id d12so8844205plr.6 for ; Mon, 29 Aug 2022 11:41:57 -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; bh=qMo2BeLrtj91nopBHoVSTvJhtNl7A+ypG14iH2k8FGY=; b=ZpgS7uftmGFZSOl04iBzw07gfA6KeIJ2fQHgJdHp6/ptvxE1Dq+yURTcxPw9CIbR24 VCgXc2jNbaXZyz0DbzDzs5WYsY+fqxBtzVLvidscqpcSmWAtV14FLFAXQVnQwcCvOejU yHjNE+9yxlHEeYS3nMHg2hto6ctteXCgqaPGY= 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; bh=qMo2BeLrtj91nopBHoVSTvJhtNl7A+ypG14iH2k8FGY=; b=RqqvC0U6mcC3uOFMcK1WjxUlBpA9z8G/ulubTV38IOJSD8yrQde4oF9lB4K88rQHxJ qWumtMyp6PHAmGbfRDLo+9PXIZ2UCWWZTfgmnugdL4hDRV148uv2Jk3VhFGk53YoNaeY L1ch7AUYR30lif2Xe4hdL0zeJmuISj76iGlGlr3G2DUuWfTkpcDit1c4DqeD+K3adb/v qGwxvuBdNKu9Va/VNHEssNnnprJ+Y+0xeJkF8L/TIu1o/gcQnwPfUBgPCBHzqZgpezoW /KyvVvg+JT4fj9TGUKO1x9EdNx5BLzjfaApurq9BhPXeylwqdEXJl8xkQNMhlvrfP8Je u9CQ== X-Gm-Message-State: ACgBeo3bxIYiY4E5DbMpxh0kIi73P8iFLNmyVqvtpHnFNOcnZZ7EXuzU hnMLI51xKPk9HlFHy401dhLlvA== X-Google-Smtp-Source: AA6agR7hMWj5/1V3tsTMLSCcFFbtUriMndHyxL8lVLtumQeeomynZwBGu9ElH5+6JDkGSIEupOzN3A== X-Received: by 2002:a17:902:c611:b0:174:7f4c:3b4d with SMTP id r17-20020a170902c61100b001747f4c3b4dmr10823339plr.130.1661798517134; Mon, 29 Aug 2022 11:41:57 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:41:56 -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 v4 09/12] drm: bridge: samsung-dsim: Add atomic_get_input_bus_fmts Date: Tue, 30 Aug 2022 00:10:28 +0530 Message-Id: <20220829184031.1863663-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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. 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 724fd76435c6..871cc8cc5352 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 @@ -1341,6 +1342,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, @@ -1380,6 +1407,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 Mon Aug 29 18:40:29 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601422 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 9B14AECAAD2 for ; Mon, 29 Aug 2022 18:42:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229844AbiH2SmG (ORCPT ); Mon, 29 Aug 2022 14:42:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60128 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229786AbiH2SmF (ORCPT ); Mon, 29 Aug 2022 14:42:05 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B0D0C82D2F for ; Mon, 29 Aug 2022 11:42:04 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id 142so9045149pfu.10 for ; Mon, 29 Aug 2022 11:42:04 -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; bh=gg+A4/98sts77T30oMd2QqQaJoBU8yXhs87UapIfZsk=; b=aBmth8jStXvVwvHfKY8BHZUhkLqaYnA89PKvSTsQ5vQUqmU8p7UuEb+dB4pvY5Ucvg mcC4Z/IvqltQVv5S4Td1q7p61KSYfEIIKFT6SubsfQpghSk1bUw7P3/FJZH1VvqnsSp0 HlslYcl7fqqa4sx6gIu35LNHnK8wI+DIx1Kr4= 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; bh=gg+A4/98sts77T30oMd2QqQaJoBU8yXhs87UapIfZsk=; b=1d+0wB+qLlcGOBdINUii88VKBL/u31C/oaTvznVz225AwOARY2tN/bzLho5DZRKwro VbS7giLXiyHmL2HVb63eAunHLXaRC2HtNyqJyJrHa/yXNAZ+FHjck8XuHH3NqXXfRR1n ZsDp56XEeRQM1XxgZFfSBH16Q+/PVX6F4rwuRjB2nC4n9TfzXNwuttecBbKJTWCDGbuB H0nSub1yJYoN8uxBF6IL5tiKCCwb3vSXQ9oU8LfC4WstqC2XFUp40DTAveioibFg6QfU Z+w+DPKIQ5oVjwFEX1Oict4Hl9PLTkaHOTPd8Rgk/TAUovp2hyrbMO4WuWNJc9DDJy1+ n/CA== X-Gm-Message-State: ACgBeo1JciJv0gg145lkAzDj1p1O02FnLd4OPA7VVL4oXZqBAUSriXKM SJuMov1Oy5RDeLA4Rqb16Cvb5A== X-Google-Smtp-Source: AA6agR5I1L27Rd+FZsw1WB+4G0p1imMCRH56Suy/n5wfU/sw+O/azOzB5h8k60Qbi25m+E1df1GA9A== X-Received: by 2002:a05:6a00:1826:b0:537:b261:3e4d with SMTP id y38-20020a056a00182600b00537b2613e4dmr18086398pfa.65.1661798524198; Mon, 29 Aug 2022 11:42:04 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.41.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:42:03 -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 v4 10/12] drm: bridge: samsung-dsim: Add input_bus_flags Date: Tue, 30 Aug 2022 00:10:29 +0530 Message-Id: <20220829184031.1863663-11-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.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. v4, v3, v2: * none 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 871cc8cc5352..f3b5e265b027 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1593,6 +1593,10 @@ __weak void samsung_dsim_plat_remove(struct samsung_dsim *priv) { } +static const struct drm_bridge_timings samsung_dsim_bridge_timings = { + .input_bus_flags = DRM_BUS_FLAG_DE_LOW, +}; + static int samsung_dsim_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; @@ -1672,6 +1676,7 @@ static 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->driver_data->quirks & DSIM_QUIRK_PLAT_DATA) From patchwork Mon Aug 29 18:40:30 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601062 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 1B400ECAAD8 for ; Mon, 29 Aug 2022 18:42:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229907AbiH2SmR (ORCPT ); Mon, 29 Aug 2022 14:42:17 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60486 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229925AbiH2SmN (ORCPT ); Mon, 29 Aug 2022 14:42:13 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id EC4EF832DC for ; Mon, 29 Aug 2022 11:42:11 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id y1so6988414plb.2 for ; Mon, 29 Aug 2022 11:42: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; bh=G5us0GccePnAC3wVw9NR5mJwNnkTd3GEPACcJ6N2xfM=; b=ixsSx2pg6G3XbINEs9wWUT6eb/1pe4V7HSvotl6YRGTb4X2U9ViVUlHparslx5uvmY MWa0L3jzH8XtuoFoFUKkmGQQMASC4zDQmmhnyP5He417ujnC3KHBwPb49oFb7g6L7x2y 3zwA+YO/IodPFntZZVtuuvyg1TzNDz6uZpwdc= 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; bh=G5us0GccePnAC3wVw9NR5mJwNnkTd3GEPACcJ6N2xfM=; b=pPRQhZZQ0jOz6xvcyEEDplHDBWNK+Jt2z7C5Dlgtj46+qe2lqESPY/Oscl0JlZKhVB fW22fScw9Ib1Fp/VEa1eS7WYa3Q3yYs2Ytp/hU+tCGxfFXlmShAJGsrUEsvZF3WFvWM3 7NeyAaOeGgJ/5bT9RRa/JwJJ2ROMHwmtDDV54OG6GnMNX+4dOx6Bx9Cndnr0J6gmscmB MYlF+IP5E55Rn1kIf50+B4SHl33ikjzLsfeJ5tKa44y2LnU444QLlgeIknjSG3Uyb/6C UXNi3rfpTBqg7lNDxZXIVHrnTucJTaZ/2s6RHuSRNtyG/AbLxiSjlEf5DP3aNFk/7E7E NHPw== X-Gm-Message-State: ACgBeo23Y6vikzGVl1pJr65VVWqEnFWy400cQCDCcTxzmP6Jsv+/nb5a 0/eptLlE73+TOD2BqGcTbPGAMg== X-Google-Smtp-Source: AA6agR7E695eeXsLzO3oj+CBg/g3fkfBjtTPyuYsP2X9XEv8GfAXp86Q9lOoz+sFpU2whGx8uemFtw== X-Received: by 2002:a17:902:d181:b0:174:11d5:b2e0 with SMTP id m1-20020a170902d18100b0017411d5b2e0mr17334216plb.114.1661798531320; Mon, 29 Aug 2022 11:42:11 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.42.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:42: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 v4 11/12] dt-bindings: display: exynos: dsim: Add NXP i.MX8MM support Date: Tue, 30 Aug 2022 00:10:30 +0530 Message-Id: <20220829184031.1863663-12-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Samsung MIPI DSIM bridge can also be found in i.MX8MM SoC. Add dt-bingings for it. 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 Mon Aug 29 18:40:31 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 601421 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 vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id A3EC0ECAAD8 for ; Mon, 29 Aug 2022 18:42:25 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229904AbiH2SmX (ORCPT ); Mon, 29 Aug 2022 14:42:23 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60480 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229946AbiH2SmU (ORCPT ); Mon, 29 Aug 2022 14:42:20 -0400 Received: from mail-pl1-x62e.google.com (mail-pl1-x62e.google.com [IPv6:2607:f8b0:4864:20::62e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 485E982FA9 for ; Mon, 29 Aug 2022 11:42:19 -0700 (PDT) Received: by mail-pl1-x62e.google.com with SMTP id jm11so8827251plb.13 for ; Mon, 29 Aug 2022 11:42:19 -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; bh=8WDhZieMsByGwgQC3v545Iffr6do/AWQnpqTM/oRp20=; b=kyEZ9/UC5f9LaL8dDz+LJhHWBRidAfWPO7AHXkqBehnO4oRIyCwRyAh6/iD7D2UagA bimOmQ/3dlMoSJ1NtqgJ3SbKrbxIhpEdXJW6qOqUujfv46+BJcNMPOc+aDNr6O1R5BoH IcK9873lc4ZUFHoKaI3dEIyZ9a1BBf9Qtu6hg= 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; bh=8WDhZieMsByGwgQC3v545Iffr6do/AWQnpqTM/oRp20=; b=67Ex/cfotcA/BGigbzCsJAFsCBP14Du2wbVyOw3rCpUPeNnKak8cvnbFf2nv6nUUj3 wylp3ZhZ1Q0tMcdtbA3Ls6DnzGkCzGMI/Aie2GHyXs6hO29eqBQbZj/VaiJqZ3EODi3h vDPSN3x+VcndtoxbuWXD3QcsubQw2hlKCYZDSJBkuH4vAHOb7N9zz1GLRfrSb5tdajcp BjKyBLFyJRnMP12EQqt5pT+rGwNE9acE3n4+k15BBQuTusZQ90FcSR82LG45Jsnaal/6 RvzxUm9y5lvtYfeCwu+hvMJUwR1AOi/CkmSnHKX9oyol4lc3BOiPzELc9FgAsOEcY0YX 4F6w== X-Gm-Message-State: ACgBeo0pjnSUK/lcYFUG7Mj1c5pHW4I/t0FfTym2eJTqhU0d3DvQcUC9 0jPD3pxZKxH1tWWu2eP/9CMrqQ== X-Google-Smtp-Source: AA6agR4B8Be6uJsgVb5OokVMdDE0b2F83LHWuYgrGmP/SmTgI7dkrtZXxQo9mjh5QoplaNLgKuD/gg== X-Received: by 2002:a17:902:d2ca:b0:174:cbbc:3630 with SMTP id n10-20020a170902d2ca00b00174cbbc3630mr5789765plc.76.1661798538790; Mon, 29 Aug 2022 11:42:18 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:43f7:1644:6259:830d]) by smtp.gmail.com with ESMTPSA id k13-20020aa7998d000000b005385e2e86eesm1619042pfh.18.2022.08.29.11.42.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 29 Aug 2022 11:42:18 -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 v4 12/12] drm: bridge: samsung-dsim: Add i.MX8MM support Date: Tue, 30 Aug 2022 00:10:31 +0530 Message-Id: <20220829184031.1863663-13-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220829184031.1863663-1-jagan@amarulasolutions.com> References: <20220829184031.1863663-1-jagan@amarulasolutions.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-samsung-soc@vger.kernel.org Samsung MIPI DSIM master can also be found in i.MX8MM SoC. Add compatible and associated driver_data for it. v4: * none v3: * enable DSIM_QUIRK_FIXUP_SYNC_POL quirk v2: * collect Laurent r-b v1: * none Reviewed-by: Laurent Pinchart Signed-off-by: Jagan Teki --- drivers/gpu/drm/bridge/samsung-dsim.c | 35 +++++++++++++++++++++++++++ 1 file changed, 35 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index f3b5e265b027..749b11e19217 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, @@ -426,6 +444,19 @@ static const struct samsung_dsim_driver_data exynos5422_dsi_driver_data = { .quirks = DSIM_QUIRK_PLAT_DATA, }; +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, + .pll_p_offset = 14, + .reg_values = imx8mm_dsim_reg_values, + .quirks = DSIM_QUIRK_FIXUP_SYNC_POL, +}; + static const struct of_device_id samsung_dsim_of_match[] = { { .compatible = "samsung,exynos3250-mipi-dsi", @@ -447,6 +478,10 @@ static const struct of_device_id samsung_dsim_of_match[] = { .compatible = "samsung,exynos5433-mipi-dsi", .data = &exynos5433_dsi_driver_data }, + { + .compatible = "fsl,imx8mm-mipi-dsim", + .data = &imx8mm_dsi_driver_data + }, { /* sentinel. */ } };