From patchwork Fri Sep 16 18:17: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: 12978760 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 bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 251FDECAAD8 for ; Fri, 16 Sep 2022 18:21:50 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=HoZlhJ3WZ56AejeMjgAWtqbCKnuaSFMjZHnqd4K8tG8=; b=zM5IgFeN5IPnyL RdsJiDHyG/Ijxf1fsQsBwVd80OAPQzCNtSaQs77e66XCxnKqVlo0deTArMekNoxaOXiT3UZA4DArV 5/WRKXzHDV0UPWz7hHZUaaX6drfoN5RQt0IOWtWiP6nWZG14bnSs74bUNzmD2atrURMU+CZKHSF8a zc+ZM6Y5FI16LSv8Obzh+jz+CwB/GLhYzIRo4uCCMfUBSJuACJiswb6kpuyl/TgqzJaXbY6PQeURN JkoLxjAN763ayg/JJSeu4+AHSOvyR9m75i4mMTxu/9iu9rgYf1DLrq6rJWNbyTpODrcVIJlAnQL2S tb7uR8OisgWWvAH7IBYw==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZFx8-00Fm6a-4W; Fri, 16 Sep 2022 18:20:38 +0000 Received: from mail-pj1-x102a.google.com ([2607:f8b0:4864:20::102a]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1oZFvf-00FlRD-S0 for linux-arm-kernel@lists.infradead.org; Fri, 16 Sep 2022 18:19:17 +0000 Received: by mail-pj1-x102a.google.com with SMTP id ge9so10310088pjb.1 for ; Fri, 16 Sep 2022 11:19:05 -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:subject:date; bh=btq8+UvEuEu4v/DMPqax3KQNrb7VRjirbnKm5H1X5d4=; b=YdBKDmr3sXtbPM/f1RFYSy36rI90QAemtIF0NfqOj6gxl5hT6RhWPNx1kF5u3SWRsg qdA+vypt8+c3kx6qYGL8uZuKBuA7ptHoH6aAyi81pAAYWEvVhA5Cr5YOQS1+MGcP3Ycs 2VuGfz7uRc0+OYDaycHuTAT3H/RsKalTt3Q6c= 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 :subject:date; bh=btq8+UvEuEu4v/DMPqax3KQNrb7VRjirbnKm5H1X5d4=; b=1Mv4LD+MLDqO1pmjPYTKz0cbpfc0KSk8d+Vs073Rcn3xb6U2JFIKT1zxGyCV4z5MN/ qb3XiyxPLtXg3PQFqmMiR0P0O0Sg0kF6kJnUjijjW1ORy7DUi9y7zwERsPH4EBdbvvo/ Oka1CFFgMGQwxrNIpAx4N/lSEOmTbSyw+LjABunEbSS4JNbxKdduwtJDPkPFeDSR56uy DLOJ/HGQ3v8sX8Zfa4xNuwuh9cBuMdvvd5LZZmadUiUYywIKCNdR32//N0fUThmo7ZV+ 2qUmlO1ENB5j14RH6AuBSzOBjneE4zOQS4NnmFuXF9xbFDeDIiyrO4K3ZeCrqQCj2KpL 3I3A== X-Gm-Message-State: ACrzQf3I15+eLDPCNsq2GDg4RI7LrYoXsT0iB/zuj1NEgUr/x4BxT2SX /gk/cXbexmh8fvPJyhwwoLhjxw== X-Google-Smtp-Source: AMsMyM5Yo3Kl8awJvYOisIZ3GPjLjoGmJhsTyQWPKvT3XeYfdgGBcIDp/PLG1WiEruiDzYuF96ooHw== X-Received: by 2002:a17:90a:9295:b0:202:582b:1765 with SMTP id n21-20020a17090a929500b00202582b1765mr6666216pjo.99.1663352344609; Fri, 16 Sep 2022 11:19:04 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a073:ae5d:6ee4:5c2f:6733]) by smtp.gmail.com with ESMTPSA id d14-20020a17090a6a4e00b002007b60e288sm1770000pjm.23.2022.09.16.11.18.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 16 Sep 2022 11:19: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 v5 06/11] drm: bridge: samsung-dsim: Add atomic_check Date: Fri, 16 Sep 2022 23:47:26 +0530 Message-Id: <20220916181731.89764-7-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220916181731.89764-1-jagan@amarulasolutions.com> References: <20220916181731.89764-1-jagan@amarulasolutions.com> MIME-Version: 1.0 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20220916_111907_998734_220258EB X-CRM114-Status: GOOD ( 16.48 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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." No clear evidence about whether it can be documentation issues or something, so added a comment FIXME for this and updated the active low sync polarities using SAMSUNG_DSIM_TYPE_IMX8MM hw_type. v5: * rebase based new bridge changes [mszyprow] * remove DSIM_QUIRK_FIXUP_SYNC_POL * add hw_type check for sync polarities change. 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 | 26 ++++++++++++++++++++++++++ include/drm/bridge/samsung-dsim.h | 1 + 2 files changed, 27 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index 6d524338d4ff..8abf89326424 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1315,6 +1315,31 @@ 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->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); + } + + 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) @@ -1337,6 +1362,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 57b27d75369e..0c5a905f3de7 100644 --- a/include/drm/bridge/samsung-dsim.h +++ b/include/drm/bridge/samsung-dsim.h @@ -27,6 +27,7 @@ enum samsung_dsim_type { SAMSUNG_DSIM_TYPE_EXYNOS5410, SAMSUNG_DSIM_TYPE_EXYNOS5422, SAMSUNG_DSIM_TYPE_EXYNOS5433, + SAMSUNG_DSIM_TYPE_IMX8MM, SAMSUNG_DSIM_TYPE_COUNT, };