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: 2326 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pl1-f199.google.com (mail-pl1-f199.google.com [209.85.214.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 457A840F47 for ; Mon, 29 Aug 2022 20:41:52 +0200 (CEST) Received: by mail-pl1-f199.google.com with SMTP id b9-20020a170903228900b001730a0e11e5sf6609847plh.19 for ; Mon, 29 Aug 2022 11:41:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1661798511; cv=pass; d=google.com; s=arc-20160816; b=qTYf3NkAKZLigkcrBvYDqJg7v1KhBqugMXE2q11LiYOcZcqRDZ8q3MdxoRtErSHDBk kXCmd5agmdkoDDYox+0OsJ36A2VjSBlYoaurpYQ7rarDm4kiJzKm8m3HWKtvgMEk85Gi K2cZRvSICuIIb3Jt7ELohAbkqjCVWqkF/uoYCQVm8zAQZS5J/ELGRHzwKxkCrpsOBVAW NhukPtQpJH8TWesTzqeGMkgzGcxHNnTyUtWZPw7sgMI4dhVqNpdJIY3IMS0UazYlfaKc MGEHPXjfCF+zcg/fYkjSNkFSADBS3YHDQDAPmkl3K6TN2UNfYR+FGtz0dnf1E7uwn/E/ JvZw== 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=kpXoZY63ICIUE1lpIOMXpAdeVCB2R0MXBhPE0H2l+cs=; b=avzBHUTpxgTICk99Cyw05CMkd7AYf3DKSlFNvUleKQazSzSGvEZ7Xd14+zfLBpwrOH S9ZClJgF+qzXi18G1xbaI1Cy6p3MBRo4AehKcNar49qd+qLFIzqq/dIT/6NILjmI8DDt KVGc5KEa3gI3nYB5Fjwha6rHaR1nmYye6AQVo2rt/RZ88bmYrYC4a/gRF3+9pyU3C4SE dx9cvafozOWnpZrcYUwgtB/+hLTAPGo9Bx9VR270oY92SZN0vHlXQG20FotyJMZCQAIl gCBv74WHNdFmm9NViucsp1L/00nwhWTr5Rve/AXtISRoeAFkGD8rVoBQ2wMNuB+ukL06 UurA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JthEQfkD; 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; bh=kpXoZY63ICIUE1lpIOMXpAdeVCB2R0MXBhPE0H2l+cs=; b=jFMpntlwkJXCJlqZCpc1Xz+Qr6S6MxE04l30HESLUXO4BfNsO49kHnVP68Av2q4hoA PwaObrPqwUuWvd5kaV1Zt8iUHjtvNbz8kU9j8486uE/Nch4cCoONSKTXK4cdVhQn8b3V QJqJH9Pg7EATzGWstfiUrf/gnzjb9i4aRvt0w= 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; bh=kpXoZY63ICIUE1lpIOMXpAdeVCB2R0MXBhPE0H2l+cs=; b=LE4ExUK6d6hJzHlZTeDBsC7JOBt9nFWdWmALljYxcw4SBHF0xPP6XthWfzc1vxf9JV 8wNHSEEcd5p+hUbEbt1EN1079h9QVmVhw4MzIe6CVlHuQiN7XPjDiigl71pKsRRuchGg qC0RhNdlHrL0xjTodd3w0BIEESfHCZf0EvsWsinSeofq0AFg0eIEqbCemhCoYGvBHnSF LXCfA69J3mPIZc773q2CW7e+xfSTgaIuklfH62P+yaEB2jhctlOWrsXBXkjazt591mb+ 1o60nuDYdagN4V1HpLC7pfWNTonK6Pr58upPY905e0uKpbg7yq2jzX8uYVpDbyxuSPhK KIYQ== X-Gm-Message-State: ACgBeo3WrhkVKRk//fmjmUqvYHpP1tVJckx5cZDtodTwdXG730cXx+Mz 4XpHvCgyI1q+oW8dg+yl/gAx6ZX0 X-Google-Smtp-Source: AA6agR6aUf5mORSxNqtvX+9GMyGr69GCSLEx4wxgCC1u+rbqj/nudbRSxe/xSqmXQbGRIE9rP5LT3A== X-Received: by 2002:a17:90b:b16:b0:1fd:b47c:6ab with SMTP id bf22-20020a17090b0b1600b001fdb47c06abmr9086479pjb.203.1661798511009; Mon, 29 Aug 2022 11:41:51 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:4e8f:b0:1fd:71dc:65f5 with SMTP id o15-20020a17090a4e8f00b001fd71dc65f5ls5322307pjh.3.-pod-canary-gmail; Mon, 29 Aug 2022 11:41:50 -0700 (PDT) X-Received: by 2002:a17:902:a411:b0:172:766e:7f3d with SMTP id p17-20020a170902a41100b00172766e7f3dmr16871579plq.24.1661798510099; Mon, 29 Aug 2022 11:41:50 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1661798510; cv=none; d=google.com; s=arc-20160816; b=YixQakR8ZCvBKyZl4E1nPjn7yNwe3G9SUDIECdG+ARFeJnmu88MHTbxjRlkRt26/HJ nyPwHrcLBK796Tfhys7oubYhQ5WWr/pMYvZ1zE/097vbwt/gLFT/KdxdAxfGNuSROvDb MHR9D+tqa09GOoLPZtsmlghiybmrq/+JeAMzQ7iNcyC3ssyzmBrbc1uEihMZm/QeF7DD YPZya7d3zj1uH+4ZlVbXRZSf4aAYFiFnJ6qtzcnfXdQ73f1AX6wXTwcCJAqD0NLSzn93 mfnNfx0zmAYRZRWDKqx0aCuSuCFLPuN5fzxzOEE0PeNZpOJvzi42aPyj0U98PlyL4T+h jOpA== 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=afY7o/rHKgz7bPVIsHlJqcMLg2zdE5JP0LSEIlSKELQ=; b=OOVE5ULhFGlbkWRaq9DPlTGFimw+tdv9Izm3XmAS42sbO+e2/GpJwCXp9SIIVFnIrd tBGHvoJATu3NctG4wmj/IYwJjJXil6jPfGox+cooGDFUB7aNrRrXj3G431JffVgMYQ8w 5wMCFkIS249N6iDXp9phaMWDiV7jNxrYVJaBi1zurqKgk5hjCEsB0/VQHQIJQ7fn/4J3 cZoyvJWEl5twY0o8P3QQSZw2bHqlcjVt4MlgwWAR4149cw8lGQN5zs3tYX3TUb5R7zHU Vp7/VfqzukHntCVHkDzgF/fYLSlYNIJi8Uf25WA2DCJtMA0rjp3QpjOpAbOGi4gGOR8J WTUg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JthEQfkD; 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 b7-20020a636707000000b0042a0dab10a4sor35021pgc.5.2022.08.29.11.41.50 for (Google Transport Security); Mon, 29 Aug 2022 11:41:50 -0700 (PDT) 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: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 X-Original-Sender: jagan@amarulasolutions.com X-Original-Authentication-Results: mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=JthEQfkD; 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: , 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 {