From patchwork Fri Mar 3 14:51:29 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2770 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pj1-f70.google.com (mail-pj1-f70.google.com [209.85.216.70]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 72F0944AA6 for ; Fri, 3 Mar 2023 15:52:54 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id u8-20020a17090ae00800b00237e4f46c8bsf1047320pjy.7 for ; Fri, 03 Mar 2023 06:52:54 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1677855173; cv=pass; d=google.com; s=arc-20160816; b=AIlt4lYPUxrBt3kHA5GRyXK9JE4q8tyhSnGCsmlQ2z/pcDgGAvDVXPOHa3jOA1gX/2 tRBCwod4Ymk+VaM5JmVZV0SSMTl4bSju4PgoJhFxGwpsByOX/E5rgd5acOV/+c8F6JA0 84pCqOYNXy8oo67pGbp+qlwynNBm1YKlzOF4DMT0FEv2wLqG2BHN+MuH01Nx9QSoPPxP 3GICRkrOBTenhyzY7v29C6rZHq3N79aNymMAhK7xSD+0I3b2L695XK4lNoiQiIeleTnM OILvoQWjV8QO36w1akpidGQWUBbVKo4QSzxXvXkeVJnjKughoxSGg2SczLzcA/cwr2El Vr8w== 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=amX+MyFJlf0/6Zp5LaYKz9jzp21ReJLD0x6zxDRM+nA=; b=pBKQWDb3eF9z6DwhebR59WTF3mdRnJaHrJwdFMJn/ov6nHWA8e5Pfj1/Q3sT4OmbKD V9a52/YIm00r8pzziuDg09ZQ/qYL/F0UNEnQZlulOVvEDUmmXUaekAN41NXRF/ZGACdF yCF9vdHQGiXs6kYJvXGetP5hyLX6nPr3Evx2vniI4WmFkjnkFtJyHJOlcNIWa4DP9hfV vmSWo2U4KsLsBqia3cORLLu1AIEd1AEF1/xgJQBpO1+VHsaZe2h3dvb6ZoOr1Y5HcIBT KU/Z7gtmK3yYjveBqUcxGicthPxNW/iq577Ssma4ooLSN5J5OjSQpWZCdVZdYHqAF2gR rN4g== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ssp71cr+; 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; t=1677855173; 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=amX+MyFJlf0/6Zp5LaYKz9jzp21ReJLD0x6zxDRM+nA=; b=adO9yW0W+5NcwwE39oIWSHWYgZH5ZiB3mAVfgJJzjTwQmAxs/F3qI5DMenSjDZEdpw ih8E9w0WyIkPQ2Vhz/CQ+tdUp+bACeBT1nvkaqkjAxppflYVz95vNOAf4eA2wzpSj/Ix pRAQVyD0SKixA/34mZ5lsYLfE4Pd3U7XB3O1M= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1677855173; 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=amX+MyFJlf0/6Zp5LaYKz9jzp21ReJLD0x6zxDRM+nA=; b=RrXARAeojdLScxddHIbKOxhPu8HHRkHCH52ec7/22flmBp6A5/9vaPpzkTr8KhrNg2 1uO/qfAVKbSBAudmJw/7uyZ7kS+4ACaQgsg53yCq9AwMovQSDHxYF/0lF0/GxZBGKKq7 1GdVJd7oRUSJf44p8XxnJ0QFutrTuWEUioojGnm+xjeMNmogIqHnKsfg9G1DIxP5M2Ue kjXUWRf0t+7ORFUL+H8+l5OS7iREZPv/VJnXBJBMeTGu9kc70zuJQgQGES+h7QxqdTeG rE4hpEEJX0HZFvx9Km9/DM7rp7sFJ+z+cGWL2XalsCX0JOoW3H8U9NFB40utG5HBa4yQ sIxQ== X-Gm-Message-State: AO0yUKV/pVSUWrYT2aEXcMg0zgws6utVZzGijRvjHPkF2U7a1svVYaZI WBwQWh5303F9jbbxHCtXBYScQ2Uj X-Google-Smtp-Source: AK7set/RadwWSNu+pcf7CRo3IbOCuY2BY6GlbyuirxeGvs+Y1hUzjADEFq/nZx1qR0EJEw+8x4dQCQ== X-Received: by 2002:a05:6a00:1d9f:b0:5a8:aaa1:6c05 with SMTP id z31-20020a056a001d9f00b005a8aaa16c05mr2720473pfw.2.1677855173141; Fri, 03 Mar 2023 06:52:53 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:90b:2681:b0:234:2ef4:2e9 with SMTP id pl1-20020a17090b268100b002342ef402e9ls3135774pjb.0.-pod-control-gmail; Fri, 03 Mar 2023 06:52:52 -0800 (PST) X-Received: by 2002:a17:90a:7489:b0:230:7a3a:d4cc with SMTP id p9-20020a17090a748900b002307a3ad4ccmr1798442pjk.43.1677855172104; Fri, 03 Mar 2023 06:52:52 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1677855172; cv=none; d=google.com; s=arc-20160816; b=BQUAC99rD4K97u72szZjpuHWWkxUoik3XBeQRkKiwGxSRNeCieMytUZp2CHuTHL46G hFooBNz74oy06h94dApJBPGNc3WkP7Z6vMqa9LGvk+Gd+PqsOM+s/TjUOb8XLNPjONfo AqZSyKLkit6H4NwF26EMT0+kgRdALUL/DE6ubtb0W32DsUQHA3KkYjnWTsgluAysMJ67 cVWfyRVPfjmcFnl24GD7bLq10lGDudtRAWikMurbb/J5Y/lRwBraUp0vm4cbgrOsMwUh BR8DYpUZhDUap7hJb6JYL0TASZwE4ORc8XBlZ54pn9Nwmj58+HEJfk7a3gDBLlcwuGzX B1BQ== 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=2GNP64t5VbWNZ3TjO4FhppfcB2OtIjrbdxbfXm3Vv04=; b=WG0gGBW4DyhjXfQcisjQ5yP75HZXiJYxf1ygJde2POQMFXKebTgHsI+Uuo4wsMk3Nn eShREPDKExYjaZEQ3mYk7VzCVARwYbcyEHJLT/Dv6e4+3GQqKCrlNkxZtTCDweo/QKJV TxBoBDNFTy1cRsP7MTsBNugXKdIxRqUgx12QDXdQYzwI3cqqIeeA7KTTj42+o5ZQV+SJ 4d0nmYskrjyiluLauqVJtEzPdEs3nVe3U2IxM3+1n8t2rXakdEXJ3oPUN7HYJhqC0Tk1 xS38nrmOudbfNdZeyWVB2ozbr9zTEjbiXOqnrbeRXyDiuiIFjcJYlI8qvn0auYAw6Kqu vrZA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=Ssp71cr+; 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 bt22-20020a17090af01600b00228e5d8a8fdsor2599386pjb.15.2023.03.03.06.52.52 for (Google Transport Security); Fri, 03 Mar 2023 06:52:52 -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:90a:1957:b0:237:659a:a44d with SMTP id 23-20020a17090a195700b00237659aa44dmr2090856pjh.9.1677855171757; Fri, 03 Mar 2023 06:52:51 -0800 (PST) Received: from localhost.localdomain ([183.83.137.89]) by smtp.gmail.com with ESMTPSA id z4-20020a63e544000000b00502fd70b0bdsm1660856pgj.52.2023.03.03.06.52.46 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 03 Mar 2023 06:52:51 -0800 (PST) From: Jagan Teki To: Andrzej Hajda , Inki Dae , Marek Szyprowski , Neil Armstrong , Marek Vasut , Maxime Ripard Cc: Seung-Woo Kim , Kyungmin Park , Frieder Schrempf , Tim Harvey , Adam Ford , Matteo Lisi , dri-devel@lists.freedesktop.org, linux-samsung-soc@vger.kernel.org, linux-amarula , Jagan Teki Subject: [PATCH v15 07/16] drm: exynos: dsi: Add atomic check Date: Fri, 3 Mar 2023 20:21:29 +0530 Message-Id: <20230303145138.29233-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20230303145138.29233-1-jagan@amarulasolutions.com> References: <20230303145138.29233-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=Ssp71cr+; 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 v15, 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 fe195d76ce76..796480e4a18b 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -263,6 +263,7 @@ enum exynos_dsi_type { DSIM_TYPE_EXYNOS5410, DSIM_TYPE_EXYNOS5422, DSIM_TYPE_EXYNOS5433, + DSIM_TYPE_IMX8MM, DSIM_TYPE_COUNT, }; @@ -1465,6 +1466,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) @@ -1487,6 +1514,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,