From patchwork Mon Feb 27 11:39:16 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2749 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f200.google.com (mail-pl1-f200.google.com [209.85.214.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 3676D3F9C2 for ; Mon, 27 Feb 2023 12:40:42 +0100 (CET) Received: by mail-pl1-f200.google.com with SMTP id c3-20020a170902724300b0019d1ffec36dsf798822pll.9 for ; Mon, 27 Feb 2023 03:40:42 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677498041; cv=pass; d=google.com; s=arc-20160816; b=orbz870Y5cvjwmrouPV9v2Gj6AbwwCFuf9cgk0HeZu4xZWcm0pvDpAYZEk1M4WIIeS 8iLoO+a+r0oXaXHIADzCX6V3h9ZaxdMIR/QXAPzpUiVcasmYOa43fCtiJZVfzlQeqf+l bdM27/z+vwsTbBg4mQFHYmquDg37mFsiR5uwTo0/TDgx05Pz8WX/cWiovmlfDNXb1iCe omsbX8+uiMtucEKwI4eOP9yul1LMrFNHYNupYI5HyT3jPKDLEqgFTAeqO0PdyQySu7fz hJJ4+QjpxWhOhpEGHRkAnrurK8M1H3OMbH/iNVv71aFuy0b4JqTIHUinhBw3rmta7VO2 fzcQ== 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:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=83kmXwv0FEn91j4mbBLndDxDHAazYhxhKccPBHQeB3k=; b=HtSvHLMBJ/L2/dHFYjqXmxx0IMlxvqBOOF6BH7/Y35+h/mraenOAcxDVpEsdnM+QhA xPTNlGbAGINLpxEOwxT7aod+RJz7/m2oWerlgHa5jCVGPU3Dr9Jf7OgLXKbcCg48xrm6 aPq8Do4SMjGmGJ0b1NCXv0ZGYr9Y29dbRpGzNhKBzx0DAN0eo6JhCaKwCGzAtVEn1Ch9 2Nh81JnowW3v4x0EcwGxYBBD7DgyXn9IFq8X0VrwqqnsPmIL9svK+sZemDuV5RFza3gv 9xZ0umz4Yb7rKYEBA2WaIvsgGfkzXms6naOjGCfcSqZtFQC1EEniDgm8sRnO98aZ0HV7 G/Xw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y96TmNpy; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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:references:in-reply-to:message-id :date:subject:cc:to:from:from:to:cc:subject:date:message-id:reply-to; bh=83kmXwv0FEn91j4mbBLndDxDHAazYhxhKccPBHQeB3k=; b=Fmgs1RHJBOvMn9gAp15Q7Mk8s93gvq5AEpNv03RxmDMwn7AE9aTXqmilrYohZGZYjp Tu0zJFEl26awDWy+SIwcP8J3Y1iaUo6DDxuAT1GDoqPTfbiXbMhLXzmBcern4ctpi+bA OUoLJWmYcBKoVcunLhhgSQuCGo4bSt3cLL/KU= 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 :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=83kmXwv0FEn91j4mbBLndDxDHAazYhxhKccPBHQeB3k=; b=UPm33Y+rvyqB68QPYDgMlTY+EQ1+0IUD05W8aMGazcwtO3F5cflwJ5iEtmzQGNVZxq bzIv++tjWaOQ2tVI3J73WDYYCgjx1VqVf0NIuQGRdu9TOiZbOKKdnEDa3tyo6fdG2WJZ erxCxU2YBYj193BYgHxZsZpdthNdD9pmaxcApb0zcHw4W/Kazg8dsYtHYgPQJdGQpwhD 2x7Yhyvt2VOvJdZfni2b7fhK+1lZYjrVXlMTEZNDjNSKiu+LnaVIGVeC5YF7hGDs0fOn NISBHDZChnJWI0OD2UlW/wivbVuOzhEUK/ufvdseaAd07nSGUojNNZFsNxvqowVr7Eds XrUg== X-Gm-Message-State: AO0yUKVBd6xerKmk67CViPj+EhlsLqSG8arOokSdCxab9o1q2n03Bna2 Ch4O+346BXay7wMDxxLLdYULZg5nY/Bumw== X-Google-Smtp-Source: AK7set+L9+zDw6KacJ9FFnKagpyhQWQ4/44j+kypp4v+AiGZDbOzxZ7LgJaimWJ/SNJFbzV9bY29ag== X-Received: by 2002:a17:902:ab1e:b0:199:2451:feaf with SMTP id ik30-20020a170902ab1e00b001992451feafmr6114512plb.3.1677498040923; Mon, 27 Feb 2023 03:40:40 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:c149:b0:19d:16ed:fd02 with SMTP id 9-20020a170902c14900b0019d16edfd02ls2722525plj.5.-pod-prod-gmail; Mon, 27 Feb 2023 03:40:40 -0800 (PST) X-Received: by 2002:a17:902:7448:b0:19c:92f5:ab4e with SMTP id e8-20020a170902744800b0019c92f5ab4emr18320672plt.18.1677498040000; Mon, 27 Feb 2023 03:40:40 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677498039; cv=none; d=google.com; s=arc-20160816; b=XZzoP5LTfwT/OrABr6bnsLPsGGt4sHDDKUWlfOUjIQ6/A1pWT449x5pWJrmMtZboF3 57CM/THVMAX/OUpSCFWdjeOr1JuiUGhSZdK4OFWJDKDKaOMhjaTrxOKk4sfJV8veECoi QW8mwjWBYZheQPoU1rtgEc2cOwnvChyh0rxXPJ9vQRveuwghzCHLX6b6scQGKk6QC8N7 lelmzjyifMKFMfqH/qHkILb50e0p9zcEW8nB8NPYEyjStxp6QWqp0U2s/u91m1PCNjLf thufk84iJAzU6VV1m7SNmpzSGdont98ysH4JGAoNx5wdy9P4TRh7EfiEuAvJuF/pSCVk I1jg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=LU+ldY5CPu/D8luQ9aqgfh0M/OSOuFnng/b9Q9chcZ8=; b=XvVhcT29IoC/5FweW9DUk/lKklyf+MY6gHlK+ODAsxR05lgfhIFfU4UZ+YG5ZTpu3w 3uNkvByuVSIitP77KU7tBLy4wBD5flmcTnANYuF/LXpBqCMbP5ly4wvTUzRsHwxGHTXM hC8OOMRM1ZM7R1z/JerAVxVtSPgLb2hGZUrKvLbtiXqN2ivJldog9rs6zEQ4vfS4OMxn fYPmAxWOoRO1QNxRb03xPKymsyn1zU4NPdhFzpWXe9uReNlvnabHioy6+8y0Ta8tfitL aAMZBXKmzb7qVyOL1vo08az7D4BUN0qqqr20u87RPQR5kdT4erZHjvEL8jJ8lLEMFVTM 2OcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y96TmNpy; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id jc4-20020a17090325c400b0019c97fadf44sor2352211plb.15.2023.02.27.03.40.39 for (Google Transport Security); Mon, 27 Feb 2023 03:40:39 -0800 (PST) Received-SPF: pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; X-Received: by 2002:a17:903:228d:b0:199:4a00:9788 with SMTP id b13-20020a170903228d00b001994a009788mr27406857plh.19.1677498039672; Mon, 27 Feb 2023 03:40:39 -0800 (PST) Received: from localhost.localdomain ([94.140.8.120]) by smtp.gmail.com with ESMTPSA id k10-20020a170902ba8a00b0019c919bccf8sm4395277pls.86.2023.02.27.03.40.33 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 27 Feb 2023 03:40:39 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Laurent Pinchart , 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 v13 09/18] drm: exynos: dsi: Add atomic check Date: Mon, 27 Feb 2023 17:09:16 +0530 Message-Id: <20230227113925.875425-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230227113925.875425-1-jagan@amarulasolutions.com> References: <20230227113925.875425-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Y96TmNpy; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@amarulasolutions.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=amarulasolutions.com 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: , 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." i.MX 8M Mini Applications Processor Reference Manual Rev. 3, 11/2020 3.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. No clear evidence about whether it can be documentation issues or something, so added proper comments on the code. Comments are suggested by Marek Vasut. Reviewed-by: Marek Vasut Reviewed-by: Frieder Schrempf Signed-off-by: Jagan Teki --- Changes for v13: - none Changes for v12: - collect RB from Marek Changes for v11: - collect RB from Frieder - fix commit message Changes for v10, v9: - none Changes for v8: - update the comments about sync signals polarities - added clear commit message by including i.MX8M Nano details Changes for v7: - fix the hw_type checking logic Changes for v6: - none Changes for v5: - rebase based new bridge changes [mszyprow] - remove DSIM_QUIRK_FIXUP_SYNC_POL - add hw_type check for sync polarities change. Changes for v4: - none Changes for v3: - add DSIM_QUIRK_FIXUP_SYNC_POL to handle mode_flasg fixup Changes for v2: - none Changes for v1: - fix mode flags in atomic_check instead of mode_fixup drivers/gpu/drm/exynos/exynos_drm_dsi.c | 28 +++++++++++++++++++++++++ 1 file changed, 28 insertions(+) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index 5723d91ff686..22e3bdcf5494 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -264,6 +264,7 @@ enum exynos_dsi_type { DSIM_TYPE_EXYNOS5410, DSIM_TYPE_EXYNOS5422, DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_IMX8MM, DSIM_TYPE_COUNT, }; @@ -1466,6 +1467,32 @@ static void exynos_dsi_atomic_post_disable(struct drm_bridge *bridge, pm_runtime_put_sync(dsi->dev); } +static int exynos_dsi_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 exynos_dsi *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. + */ + if (dsi->plat_data->hw_type == DSIM_TYPE_IMX8MM) { + 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 exynos_dsi_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -1488,6 +1515,7 @@ static const struct drm_bridge_funcs exynos_dsi_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 = exynos_dsi_atomic_check, .atomic_pre_enable = exynos_dsi_atomic_pre_enable, .atomic_enable = exynos_dsi_atomic_enable, .atomic_disable = exynos_dsi_atomic_disable,