From patchwork Sat Oct 15 22:07:53 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Marek Vasut X-Patchwork-Id: 2432 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-ed1-f69.google.com (mail-ed1-f69.google.com [209.85.208.69]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 7426844AEB for ; Sun, 16 Oct 2022 00:08:14 +0200 (CEST) Received: by mail-ed1-f69.google.com with SMTP id t5-20020a056402524500b0045cf8249863sf5948254edd.4 for ; Sat, 15 Oct 2022 15:08:14 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1665871694; cv=pass; d=google.com; s=arc-20160816; b=aLvFwc1ETx++P3Jxd5dkQTwpuMQYjzZJZ30H9uhkyEk6yXwnLUr13eRf5V4mwcWdkF xmCfCzZi0PPI1lv7U8zxj8hX0SZOCdyySqXog0GOOy5NMIGuytbtf38knRX6uaHpQHJa RXL4cdy5X2s3ES04+T8dsgR2e9Q0Zq2hd+oafhX6q+VLduc/1Kyza537KlI3+0Pz2Urb xqDKixxFRb4YeUoxoj62Y3nCOiIB3jjBo1ssBXieJ3Ezuq93tDaYyfWCAtitWzNdDCN+ TXhyw1GLFrqO+a1uHyYxoLqNwMvcMTNnRuDIjwWWZqzp0U8cLAVSEBr/IKkd9YA4D/Nb ripA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:mime-version:message-id:date:subject:cc:to :from:sender:dkim-signature; bh=8kbRyU+dRxkmBUf69HBPFXmxyMup6dc8z+3PNuAPHZQ=; b=zmHvX2ZcTN9UfgBaLlgf8Ewp3XPmmXZoDMhT0SygbTWdbQ0z0cV+oF4BpgpUMSVCe5 98yF8Z7WmwUFe9TCgizdyfVtqVZ6qy7WrG9D20umM7FC4uhuj0xggRLyIfh3h9lFR9R7 hetHA+P+1yz2Ki4YxaUIy8w+kTSP36Qryt6m4PsVuD7619kM/DkfhI5MayOHAoaNYttQ JvdxfhDyDfxPh0mZkviMptGFTRYmf95KeDxjp08tiIOkavHFDTQZiX8TRjUrQGjnxaBa wC+XM4/1d/gt3anbg81d4JUWlk1vmu+8BspOaLwej8+pe0vtfiJhQB7LuxG3b9Qxkfv5 3srg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dGsC9fe1; spf=pass (google.com: domain of marex@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=marex@denx.de DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amarulasolutions.com; s=google; h=list-unsubscribe:list-archive:list-help:list-post:list-id :mailing-list:precedence:x-original-authentication-results :x-original-sender:mime-version:message-id:date:subject:cc:to:from :sender:from:to:cc:subject:date:message-id:reply-to; bh=8kbRyU+dRxkmBUf69HBPFXmxyMup6dc8z+3PNuAPHZQ=; b=dLmxwvWBLvFSHPIcXEwQZEyzsLZwLhb+xvZ5X6qZjqgnxXNxyR+e9SrhZOoFO8VPCx iwPquTF7hpoukrYnsuOeDKIkgLUnEYutQXddj7+YKj6z+ym1yIn5e9BzfCVn8dwiBXYz pKnuPx+houKzsenrlWAXd7T61Hdw27FoV4LYY= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=list-unsubscribe:list-archive:list-help:list-post :x-spam-checked-in-group:list-id:mailing-list:precedence :x-original-authentication-results:x-original-sender:mime-version :message-id:date:subject:cc:to:from:x-gm-message-state:sender:from :to:cc:subject:date:message-id:reply-to; bh=8kbRyU+dRxkmBUf69HBPFXmxyMup6dc8z+3PNuAPHZQ=; b=I/x64bgaIUbCh+MWfF7LY2Eifqu1hohKmIT8/sNEjgpkxmdBept6/ta2tPpZPKHMMl KcEpxiazIhT4YCjwUEWm06UaUpSu5nmBfHWSesAQRG4PqSTNMaPAF/Bsw/Rg2rjHyxRS RrDoFYAjnlUpdQxBiSxj2sgzkQbfKp8yZAt0Bi1ezyEImg1fPsEq9ZW16vHFo+BNb7Zc V1HGzOuG+FB3DTrutDcJuak9z6HO0D9SB4MhkzL+/BVN68Lx1ohoNekmpcwlwcrMkQ0S jBaksCdABrIEDfUHTl2Bo6LUGdsD3GqmdwsEfMjZ6zXKVFvUipOkx02oZ8Zq8ClT/b1+ FemA== Sender: linux-amarula@amarulasolutions.com X-Gm-Message-State: ACrzQf0io/PmwTTKSfxUVc9srW9YyCmgn+HcVlyRSngKJ/RAFHvINL+J IsQtytZjhb79eI22n9IV8M0LY9gk X-Google-Smtp-Source: AMsMyM5tZMhSyXvN4Yp/3eD1b6P0DIaAFUaOcxHaQYPRbBVztfmadWD7MsF1UBIHIf1wFWO1KTLouQ== X-Received: by 2002:a17:906:5daa:b0:791:8933:f9f0 with SMTP id n10-20020a1709065daa00b007918933f9f0mr1532191ejv.335.1665871694187; Sat, 15 Oct 2022 15:08:14 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a05:6402:5244:b0:43d:b3c4:cd21 with SMTP id t4-20020a056402524400b0043db3c4cd21ls7958976edd.2.-pod-prod-gmail; Sat, 15 Oct 2022 15:08:13 -0700 (PDT) X-Received: by 2002:aa7:c041:0:b0:45c:1584:23db with SMTP id k1-20020aa7c041000000b0045c158423dbmr3930897edo.184.1665871693100; Sat, 15 Oct 2022 15:08:13 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1665871693; cv=none; d=google.com; s=arc-20160816; b=L/K2zzUrQwHLg2lyJ5ITBrKm6RONzKsKxo19HqDUgIJ2cnWMx16cgCFI8RQ+yFKsv9 MOvWO1Dwodtnhv/asursLNv+ErL4BmmXnLciQEzdVhB2G7AJQSMxa9N992Br7poIsId8 KpAiCESzRqkvLNEmA7E5MSrCz6ZHtrliBkozNzfx5BwFtAN8+qPjRgxfwdrO+2WEjSbF KMJWZjFe0fE6QddN9UFj2wS62X/tfnoHkH+/OO12cRbdEDYxp7QfMPyTJXTtVO3eYLFn WTXVsce6zc87PbL+pdUdXKwX30rz2HN/4VJK421f48XLEo6GvUkBLVMYcGfjgyWTQNVh RYMw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=AJtpN9rg3vP14kfUiS2FkQzwMilbUXuCQgOpY3IkUgk=; b=DkQnuy2Q7ev8KeMUi5vEou/yC7D3alUcFZpUnfqlfKntCnzjAPQhluYM1lJCp7w29A Qa1NxSjuUcWzrVNWtGKzwTQgUwzJkV/kA8emfdTOhIJmb8iJkbPyZuyePJmZ8JU3UlKG HAvo2UNxiKFMADP4RjRIfqX8hvdrvkPpv8N0Xnaz7aFGBNcnCDT7+7vQSEP7k+S1Cuur FK4JQFJqTiw35EyjqUmYZTbAyQhnbjMQZjH3GeLxVqyklVMK3SUA5iaQ0k4XqvxJNOud r6KnriyohzSqYu7/9b7AyT3vJ4CUokrpigPqAHc7J/UeuAjJ3Lh4vVaUddU8N0Ob/BPw XnYA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dGsC9fe1; spf=pass (google.com: domain of marex@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=marex@denx.de Received: from phobos.denx.de (phobos.denx.de. [85.214.62.61]) by mx.google.com with ESMTPS id l15-20020a170906794f00b007882926848bsi6010001ejo.818.2022.10.15.15.08.12 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 15 Oct 2022 15:08:13 -0700 (PDT) Received-SPF: pass (google.com: domain of marex@denx.de designates 85.214.62.61 as permitted sender) client-ip=85.214.62.61; Received: from tr.lan (ip-86-49-12-201.bb.vodafone.cz [86.49.12.201]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits)) (No client certificate requested) (Authenticated sender: marex@denx.de) by phobos.denx.de (Postfix) with ESMTPSA id 86E4A84E2A; Sun, 16 Oct 2022 00:08:08 +0200 (CEST) From: Marek Vasut To: dri-devel@lists.freedesktop.org Cc: Marek Vasut , Adam Ford , Andrzej Hajda , Frieder Schrempf , Inki Dae , Jagan Teki , Kyungmin Park , Laurent Pinchart , Marek Szyprowski , Matteo Lisi , Michael Nazzareno Trimarchi , NXP Linux Team , Robert Foss , Seung-Woo Kim , Tim Harvey , Tommaso Merciai , linux-amarula , linux-arm-kernel@lists.infradead.org, linux-samsung-soc@vger.kernel.org Subject: [PATCH] drm: bridge: samsung-dsim: Add i.MX8M Plus support Date: Sun, 16 Oct 2022 00:07:53 +0200 Message-Id: <20221015220753.108641-1-marex@denx.de> X-Mailer: git-send-email 2.35.1 MIME-Version: 1.0 X-Virus-Scanned: clamav-milter 0.103.6 at phobos.denx.de X-Virus-Status: Clean X-Original-Sender: marex@denx.de X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@denx.de header.s=phobos-20191101 header.b=dGsC9fe1; spf=pass (google.com: domain of marex@denx.de designates 85.214.62.61 as permitted sender) smtp.mailfrom=marex@denx.de Content-Type: text/plain; charset="UTF-8" Precedence: list Mailing-list: list linux-amarula@amarulasolutions.com; contact linux-amarula+owners@amarulasolutions.com List-ID: X-Spam-Checked-In-Group: linux-amarula@amarulasolutions.com X-Google-Group-Id: 476853432473 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Add extras to support i.MX8M Plus. The main change is the removal of HS/VS/DE signal inversion in the LCDIFv3-DSIM glue logic, otherwise the implementation of this IP in i.MX8M Plus is very much compatible with the i.MX8M Mini/Nano one. Signed-off-by: Marek Vasut Reviewed-by: Marcel Ziswiler --- Cc: Adam Ford Cc: Andrzej Hajda Cc: Frieder Schrempf Cc: Inki Dae Cc: Jagan Teki Cc: Kyungmin Park Cc: Laurent Pinchart Cc: Marek Szyprowski Cc: Matteo Lisi Cc: Michael Nazzareno Trimarchi Cc: NXP Linux Team Cc: Robert Foss Cc: Seung-Woo Kim Cc: Tim Harvey Cc: Tommaso Merciai Cc: linux-amarula Cc: linux-arm-kernel@lists.infradead.org Cc: linux-samsung-soc@vger.kernel.org To: dri-devel@lists.freedesktop.org --- drivers/gpu/drm/bridge/samsung-dsim.c | 55 +++++++++++++++++++++------ include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 44 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 012d8b6463ad6..cf40fd8813ff2 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -465,6 +465,7 @@ samsung_dsim_types[SAMSUNG_DSIM_TYPE_COUNT] = { [SAMSUNG_DSIM_TYPE_EXYNOS5422] = &exynos5422_dsi_driver_data, [SAMSUNG_DSIM_TYPE_EXYNOS5433] = &exynos5433_dsi_driver_data, [SAMSUNG_DSIM_TYPE_IMX8MM] = &imx8mm_dsi_driver_data, + [SAMSUNG_DSIM_TYPE_IMX8MP] = &imx8mm_dsi_driver_data, }; static inline struct samsung_dsim *host_to_dsi(struct mipi_dsi_host *h) @@ -1404,18 +1405,26 @@ static int samsung_dsim_atomic_check(struct drm_bridge *bridge, struct samsung_dsim *dsi = bridge_to_dsi(bridge); struct drm_display_mode *adjusted_mode = &crtc_state->adjusted_mode; + /* + * The i.MX8M Mini/Nano glue logic between LCDIF and DSIM + * inverts HS/VS/DE sync signals polarity, therefore, while + * i.MX 8M Mini Applications Processor Reference Manual Rev. 3, 11/2020 + * 13.6.3.5.2 RGB interface + * i.MX 8M Nano Applications Processor Reference Manual Rev. 2, 07/2022 + * 13.6.2.7.2 RGB interface + * both claim "Vsync, Hsync, and VDEN are active high signals.", the + * LCDIF must generate inverted HS/VS/DE signals, i.e. active LOW. + * + * The i.MX8M Plus glue logic between LCDIFv3 and DSIM does not + * implement the same behavior, therefore LCDIFv3 must generate + * HS/VS/DE signals active HIGH. + */ 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); + } else if (dsi->plat_data->hw_type == SAMSUNG_DSIM_TYPE_IMX8MP) { + adjusted_mode->flags &= ~(DRM_MODE_FLAG_NHSYNC | DRM_MODE_FLAG_NVSYNC); + adjusted_mode->flags |= (DRM_MODE_FLAG_PHSYNC | DRM_MODE_FLAG_PVSYNC); } return 0; @@ -1448,7 +1457,8 @@ static int samsung_dsim_attach(struct drm_bridge *bridge, * Passing NULL to the previous bridge makes Exynos DSI drivers * work which is exactly done before. */ - if (!(dsi->plat_data->hw_type == SAMSUNG_DSIM_TYPE_IMX8MM)) + if (dsi->plat_data->hw_type != SAMSUNG_DSIM_TYPE_IMX8MM && + dsi->plat_data->hw_type != SAMSUNG_DSIM_TYPE_IMX8MP) previous = NULL; return drm_bridge_attach(bridge->encoder, dsi->out_bridge, previous, @@ -1649,7 +1659,11 @@ 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 = { +static const struct drm_bridge_timings samsung_dsim_bridge_timings_de_high = { + .input_bus_flags = DRM_BUS_FLAG_DE_HIGH, +}; + +static const struct drm_bridge_timings samsung_dsim_bridge_timings_de_low = { .input_bus_flags = DRM_BUS_FLAG_DE_LOW, }; @@ -1733,9 +1747,17 @@ 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; + /* + * The i.MX8M Mini/Nano LCDIF-DSIM glue logic inverts DE signal + * polarity, see comment in samsung_dsim_atomic_check(). + */ + if (dsi->plat_data->hw_type == SAMSUNG_DSIM_TYPE_IMX8MM) + dsi->bridge.timings = &samsung_dsim_bridge_timings_de_low; + else + dsi->bridge.timings = &samsung_dsim_bridge_timings_de_high; + if (dsi->plat_data->host_ops && dsi->plat_data->host_ops->register_host) ret = dsi->plat_data->host_ops->register_host(dsi); @@ -1841,11 +1863,20 @@ static const struct samsung_dsim_plat_data samsung_dsim_imx8mm_pdata = { .host_ops = &samsung_dsim_generic_host_ops, }; +static const struct samsung_dsim_plat_data samsung_dsim_imx8mp_pdata = { + .hw_type = SAMSUNG_DSIM_TYPE_IMX8MP, + .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, }, + { + .compatible = "fsl,imx8mp-mipi-dsim", + .data = &samsung_dsim_imx8mp_pdata, + }, { /* sentinel. */ } }; MODULE_DEVICE_TABLE(of, samsung_dsim_of_match); diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index df3d030daec6a..3789f9dbb238b 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -28,6 +28,7 @@ enum samsung_dsim_type { SAMSUNG_DSIM_TYPE_EXYNOS5422, SAMSUNG_DSIM_TYPE_EXYNOS5433, SAMSUNG_DSIM_TYPE_IMX8MM, + SAMSUNG_DSIM_TYPE_IMX8MP, SAMSUNG_DSIM_TYPE_COUNT, };