From patchwork Thu Nov 10 18:38:46 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 2472 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pf1-f199.google.com (mail-pf1-f199.google.com [209.85.210.199]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 05C6E3F039 for ; Thu, 10 Nov 2022 19:41:08 +0100 (CET) Received: by mail-pf1-f199.google.com with SMTP id a18-20020a62bd12000000b0056e7b61ec78sf1439919pff.17 for ; Thu, 10 Nov 2022 10:41:07 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1668105666; cv=pass; d=google.com; s=arc-20160816; b=jJA/Z0NO6+llM209LSBf075NmwZlh9IE5mk3/FmUCoXI7NFMD27/oAu1wbDNwcs0UQ FoN12jqnNL1LFfisL3cp1UG0PdIGVslW0J9p/TjQl7107q674S0RVgfZqHj8nUoqzQQT 9AuLPnbWaVIB68Qd5jnYouaX+obShm5TdEoY0XKTyNm4jyJVx3WhcOp89N1rLBu/aXq2 b+zXh/hjjkgAacJ0EvZveiztwIOaTkkLC/Ag9C5jJqizmTYuNkWd+VpDRKidlkJvROc0 1gIiCz/JjZpArmD0kVk9UVBoLx1Fm7+jhOGQdV39UkTsCQPCPj4hGvmXQ61mTlmL0pxe fB7g== 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=+28ezbu0qT0AxAvVrwUbDPMFTkFDyM3bAmCfvTdW8pM=; b=p4zmUOamLdCLOj350tB0yyACixIVS7LiHilbBKgtIfWC3xPlSfuR0aeB6ZUvug2Oso jYz6992Bvb+rfE7ljhrfIzRc6RmO3c8kbV/IsBSYUt/zsJ7004fbVtZhCTI1dqY+16Cf kpXw7kAIgxdKD2+VVcxiG0Uz/7dbjCqKuwo0/9h+y/WwCXVBvJHhwmUX1zROv6VNbpB9 A2FD+IdTRb0+1lPS6xaTcpYLB0jUoxzCw1ma07eutG+YPgHEkI1QvVLCLbs0cH72feB7 F9mkdIsAuT9o//8TjguhnAULvsZ3QbIILPEg4r/ANHPqPVLYKG8ss/sCxoEHCcaNTGGv ZxlQ== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mcLoW5TT; 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=+28ezbu0qT0AxAvVrwUbDPMFTkFDyM3bAmCfvTdW8pM=; b=cHICsiobp0J6vzikDPb17xwxducgVKg3xe4QKjTB1Z2zpKHDUkFmf83k+k4v6nyhF6 hVA50McPx7XndisR0HGfPriwY9wh+hl1ora3EQusNmwrrHeSj53NhaRJjw8meCmVxSqP Gc6fo0/rMN2wVhklHNIJRoz7VkZ7ahF7wjWC8= 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=+28ezbu0qT0AxAvVrwUbDPMFTkFDyM3bAmCfvTdW8pM=; b=7P1QNEz4hFRKgxdNIszDHp8Is43z11znG/t+NXQAIsK4Puz2uEPEgPxx1w1+fluXDG awkxhY5KvjsMU7yTustI2vV/EYjdHybZK5lNsATdZl7KSD7HNquNht+6y9U4/Dh1V2gH FQ0XwvctzDVk0mj5zvxoP9cqFMbIBbG/XVaz/3ukZ8jpVOUKrJS09AXBr+oRDNw9ybad 8aY5ksamQKR2vAkYHMoPNbx7nhpqYUYg+HlzhuFEalX8q17qMOVEaURLmd6P74Fbs6l5 1IKhNrJFTwkeUZOwgapf0n5htHJjBHhlR3JRLVKbguATAh4DiOa/AiLr3IhLJKmkjeak gZVA== X-Gm-Message-State: ACrzQf32Vq9qQWUY0RGj9UfLj48XtvWbYGPqEgVz04nyB7Z8nam+d3Ri y6FEgdEzEmiAKihLyHSllNWZG5/W X-Google-Smtp-Source: AMsMyM5LYP7NAvNjEgQJXW0VQxtmjm0YsIsEE6utvNld1DbGAixI3cvFoS0jFy4PzA3SQnMH6h1iMQ== X-Received: by 2002:a17:902:ed8e:b0:187:27b3:74e5 with SMTP id e14-20020a170902ed8e00b0018727b374e5mr54427531plj.90.1668105666818; Thu, 10 Nov 2022 10:41:06 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a17:902:c3c5:b0:178:35a3:84d9 with SMTP id j5-20020a170902c3c500b0017835a384d9ls1640617plj.10.-pod-prod-gmail; Thu, 10 Nov 2022 10:41:06 -0800 (PST) X-Received: by 2002:a17:902:f691:b0:186:b250:9767 with SMTP id l17-20020a170902f69100b00186b2509767mr63835861plg.60.1668105665988; Thu, 10 Nov 2022 10:41:05 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1668105665; cv=none; d=google.com; s=arc-20160816; b=eiIjPzJsA0WbfCe90laWudx4hxJfkPNoVeG5IXQ7DLb4e9Zg7DPDJ2Wqx9BTrJwPqO juUS8s4wv9gG7Wbg9mliziQ2SYQ1zwOz740XX834T/SsNTuoj1c3Ypb5KBQzEQnVRUFv ir+Qzotbh+Av0OCnX2WxIyYowsNH1QC+3zNnbbfsty61i7fGhQng+Gr5SgZZEjUWvCod /uuF5wYtdSH3sv3NxkKMgr5vLftgXAcGwF+JF15UqPwgBn3UKS6moeNjv1w/IEJGx4yS YTkoqFgWBnYWyBoQBH2/e6wEH5iRZpuiAOIm3LRrKyTutcdIH6faCkq4+4xmAG4v7ugG fsTQ== 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=Oo60Yc6E8FyFlqiwb1b4t9ZpcglzeAFRUlIMg3kohkc=; b=h9siY+YidgoUpSvqm5z5PaHTBlUoJsvKhyoUBWt3eCb/X/jhBWgTD0u6Y5+SgEEBe3 1jkpZf9e3Vfie7PClx3o8KBUGEJcntx8xGNInSSCFEqKfBU2qTcHUJejxSPU9RZr7wvx /CKLH9KFfctzcfoFhTr5cn1Qq6YcoemoBAHntkuEFGP2knnTRLKoudrpQApPRFSet0od TemnCYLrrLx6me4RF6HsrMRhr5gWttehE3hbpJwteG8IXa64fI62pMOXWvk4h0+WTXHL 4CsPWlgXBO3c1JtB3bjZdEzwozotTfMzOQpc9TEvI1zwwrFpOhQoyByajYlHHlpiVMPB ghFQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=mcLoW5TT; 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 e18-20020a17090301d200b0017f9ccfc0dbsor1439plh.154.2022.11.10.10.41.05 for (Google Transport Security); Thu, 10 Nov 2022 10:41:05 -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:902:ab1c:b0:17e:c0f0:96a4 with SMTP id ik28-20020a170902ab1c00b0017ec0f096a4mr1747519plb.80.1668105665652; Thu, 10 Nov 2022 10:41:05 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a809:b5a4:486a:f07:f67e]) by smtp.gmail.com with ESMTPSA id c2-20020a170903234200b001869efb722csm11635627plh.215.2022.11.10.10.40.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 10 Nov 2022 10:41:05 -0800 (PST) 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 v8 07/14] drm: bridge: samsung-dsim: Add atomic_check Date: Fri, 11 Nov 2022 00:08:46 +0530 Message-Id: <20221110183853.3678209-8-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20221110183853.3678209-1-jagan@amarulasolutions.com> References: <20221110183853.3678209-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=mcLoW5TT; 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 a comment FIXME for this and updated the active low sync polarities using SAMSUNG_DSIM_TYPE_IMX8MM hw_type. v8: * update the comments about sync signals polarities * added clear commit message by including i.MX8M Nano details v7: * fix the hw_type checking logic v6: * none 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 | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) diff --git a/drivers/gpu/drm/bridge/samsung-dsim.c b/drivers/gpu/drm/bridge/samsung-dsim.c index ec7e01ae02ea..3c0a8580508b 100644 --- a/drivers/gpu/drm/bridge/samsung-dsim.c +++ b/drivers/gpu/drm/bridge/samsung-dsim.c @@ -1315,6 +1315,32 @@ 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; + + /* + * 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 == SAMSUNG_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 samsung_dsim_mode_set(struct drm_bridge *bridge, const struct drm_display_mode *mode, const struct drm_display_mode *adjusted_mode) @@ -1353,6 +1379,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,