From patchwork Wed Jul 20 15:52:06 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2196 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 4D42A3F03E for ; Wed, 20 Jul 2022 17:53:36 +0200 (CEST) Received: by mail-pg1-f200.google.com with SMTP id d66-20020a636845000000b0040a88edd9c1sf8655940pgc.13 for ; Wed, 20 Jul 2022 08:53:36 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1658332415; cv=pass; d=google.com; s=arc-20160816; b=gK5mC0eJSI+3rXB1cHwWFgZr8QJPdE5FD+gBplN9aYPUfdcQsh868NL0jLHcts9noK CYWQo7gMMGfSrtFaOHuM2vPXziiebw0ALOy5/vL0RTIEnrs+uNLe/SpOOGGKpgukQgW2 4dkFHae551WC8Yjz4AsDeJtuvaTry1od6CXtp/zjrxU4MG+HTTyY3dgexIX1pY0yOK2Y 0ojtMp6DH3NUTo6tr+x1JEUXw91C6WDRdTao0aTgaIAfxmRsowUfXho3DqnIL0HLnZVC OcAe0NiLv5GnIv9UF+iIymaMrJEiZcN2kC9P3QbDa5aSZ5BFGUjnrsvW1RRrejeck6DH jk+g== 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=Ir40ZNZprApemaia4iXpy9ZA1CH/BnNNF3sGQK/vdKY=; b=arRySivPWIDjlSI1nzh9FHzqjS1sbDiU4E/59SVYHmJFroWUr8aj8MyXDP+2qM3kJQ TwdGcVQ/h2zsEsu4Sg7qCu+VJDj6Fkor/g7kXOdEPcP21eFeSKMARaFNX39QobFag6PS Squtv/9H0arD4B/tKup++iII51b/GtwF+KfOMGOuU+mYBlP4qT+z8fPx1WepWNAvqeWL ePoAvP2cCnQRLlpor8q4QXIww4c1az1NSi49C9WXG32chCJ5JUDZem7hy1hZpgU+qGfZ l/3UEKKrKFMXHcf2A0PD8JFLGRpb35X0HEvxN7XVtAGYIkSzzSebXuCDFZaioLXfAgQw FbUA== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mHjHibFP; 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=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:x-original-sender:x-original-authentication-results :precedence:mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=Ir40ZNZprApemaia4iXpy9ZA1CH/BnNNF3sGQK/vdKY=; b=NpzlZ/X9f+j5/YZeyBf15+w4sCQmiJLy6F41+a5lRttHg5tdD/FflAMPvE5IO0NArS jyAO8kUj2jvzuv3DUvuw2N6zKNwn5g+UmR4167fbK7XQQX0SKnj7MYeyF9THD8LToCA0 FKGu6su0js2yaJH+9F2LGUKmTApFQnOkC6vWI= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:x-original-sender :x-original-authentication-results:precedence:mailing-list:list-id :x-spam-checked-in-group:list-post:list-help:list-archive :list-unsubscribe; bh=Ir40ZNZprApemaia4iXpy9ZA1CH/BnNNF3sGQK/vdKY=; b=6FCoV4x1/0JWQS+TLvNLXhewQ2miQ/2xwopyJjlsPIkyLF85otKN5DZ1V56JNakGY4 wPLxLsmK5EuioVILAdRQIqynAS8pb03Z/yfQ1Y52+HpNbOfkOMQmW1/DfqiQTvDojKbt YUZUkjwyBCW+0qCfxVbgIBRI7qZDenCrSnBB0p8CJa/K7oXKt2IpyVc20+nAurtZsKBr lu5xfoObgAX1IgWh0f7relmvYr7NgmrMOARwEU3ZdM/P1SQ6Y9SvkaVErCBk3UdbP/G9 BXp+VXYofh5wZxF5hwfDQopFUHx1r7p5yzRtcd46XkH4uiXcxHjrPR5ycUx8cVr7zdKY ImPA== X-Gm-Message-State: AJIora/HClFkwW6SvMELlw4E5HcvMz0KZEIF/MyDuv4XK9NPP33J0m8w UG7O0oavdFwcNLKTIDphUYGvgqFk X-Google-Smtp-Source: AGRyM1s2M31yXvTpTSP29WA5w/gPv5k86G8DqIHI4VWElEXZ6/kgNILYiRSlWMtfkKpBUhiDcqu1aQ== X-Received: by 2002:a17:90a:d3cb:b0:1f1:82ca:3ba0 with SMTP id d11-20020a17090ad3cb00b001f182ca3ba0mr6231142pjw.236.1658332415132; Wed, 20 Jul 2022 08:53:35 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90a:8a0a:b0:1f2:25b8:a1d7 with SMTP id w10-20020a17090a8a0a00b001f225b8a1d7ls480643pjn.2.-pod-control-gmail; Wed, 20 Jul 2022 08:53:34 -0700 (PDT) X-Received: by 2002:a17:90a:cf85:b0:1f2:297c:b4a4 with SMTP id i5-20020a17090acf8500b001f2297cb4a4mr178034pju.109.1658332414300; Wed, 20 Jul 2022 08:53:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1658332414; cv=none; d=google.com; s=arc-20160816; b=Xg5Nf56lih1EvAzr4rVvTynwwmWA/L4lcq721jK7EqBDX2xzdm84gLpoPsqzwh7Ngg AM1O/wBHb+lA5kygDwX6Jky0lHIyf+pliTofmITfVKFUGwT2fK4eqiPKUzzs6BWMO2vQ C+amLyevENqVKud5Mkgfc3MdCNPVT1ral4q+50gA9dab2BheRRUjDc9vhylSAZFIxHIk SQY4OiMGR/lKoq4cq59x2KQBxxUYKEOc75GAJ791Vd/bL/1Z64DFMwRyYdcKLrtFDejp ee9nfcjy1jWxyCPg39G0Ro7iAz0RIytGHtcdaHNz/7yqUXnTQUsjfHZnoRThAC14hFDp dOkQ== 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=1MmIYAi0CzqUnm8evBibi87aQyljaw+zPjXUhxloQug=; b=w5qjTXf0Xk6Zuzg/0+y9JX+OYEk/f/EJKx1MVVl2fPGz+Pw7+D2VmPG+jpLmtuSm5P hmcCpc9XpzlE0E5wvleG4M/PjGE/KVMGMG+Myzd8eFlofHL+toOrQPYRtGs/SQdKqoLM +jUKwOpe1Nz9knlXoY9pkFtkX2RSSYfQVZWbl3G/Q/4LsAa3bB9VkmUlSVAHeohA1t+O khoEhym/71iaF/lUnUjkkztWQ5zHVn7KeAcC3M3iuf8xo5co64ePBw/+pFlSfQ5lISQj oUoBuZoPY7xknQroog6Fg4bt55FwQ/a9gcUZbXxMZrceu7zmNx56KMc2Y/U1ZFYZ0Po5 Lokg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mHjHibFP; 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 m6-20020a17090a5a4600b001ef79eb4d54sor1099100pji.24.2022.07.20.08.53.34 for (Google Transport Security); Wed, 20 Jul 2022 08:53:34 -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:a17:90b:3b4b:b0:1ef:f5b0:ce60 with SMTP id ot11-20020a17090b3b4b00b001eff5b0ce60mr6311657pjb.71.1658332413996; Wed, 20 Jul 2022 08:53:33 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:d177:d5:aee:4f03]) by smtp.gmail.com with ESMTPSA id a8-20020a170902710800b0015e8d4eb1d7sm13919198pll.33.2022.07.20.08.53.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 20 Jul 2022 08:53:33 -0700 (PDT) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Joonyoung Shim , Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Fancy Fang , Tim Harvey , Michael Nazzareno Trimarchi , Adam Ford , Neil Armstrong , Robert Foss , Laurent Pinchart , Tommaso Merciai , Marek Vasut Cc: Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-arm-kernel@lists.infradead.org, NXP Linux Team , linux-amarula , Jagan Teki Subject: [PATCH v3 09/13] drm: bridge: samsung-dsim: Add atomic_check Date: Wed, 20 Jul 2022 21:22:06 +0530 Message-Id: <20220720155210.365977-10-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220720155210.365977-1-jagan@amarulasolutions.com> References: <20220720155210.365977-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=mHjHibFP; 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. 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 5a0fea30e9e8..376e9682e130 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1339,6 +1339,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) @@ -1361,6 +1378,7 @@ static const struct drm_bridge_funcs samsung_dsim_bridge_funcs = { .atomic_duplicate_state = drm_atomic_helper_bridge_duplicate_state, .atomic_destroy_state = drm_atomic_helper_bridge_destroy_state, .atomic_reset = drm_atomic_helper_bridge_reset, + .atomic_check = samsung_dsim_atomic_check, .atomic_pre_enable = samsung_dsim_atomic_pre_enable, .atomic_enable = samsung_dsim_atomic_enable, .atomic_disable = samsung_dsim_atomic_disable, diff --git a/include/drm/bridge/samsung-dsim.h b/include/drm/bridge/samsung-dsim.h index c852d7b9981e..4eacaf18e00a 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -35,6 +35,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 {