From patchwork Thu Mar 3 16:36:51 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1857 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 CF11A3F236 for ; Thu, 3 Mar 2022 17:37:55 +0100 (CET) Received: by mail-pj1-f70.google.com with SMTP id p5-20020a17090a748500b001bee6752974sf3299193pjk.8 for ; Thu, 03 Mar 2022 08:37:55 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1646325474; cv=pass; d=google.com; s=arc-20160816; b=icH8Ne4yG/2LL1cK7LPjq5waJ9dAON+sPJ3N2Qmaph9dfrBnDXy5uwOiAZBOG663kU oMoh6pxBvn24INC3usafhSCL6EEEBTQYmLa+1TeJSzEvBi/O87hsaCocsLMD7CY/V9fR mUghGX0tHvQXjFBZqe9mlxxgg2w8RhCKjjwSeKQk1I+yqEpQSr+dSSVoy94KjXBZiHEY a+xUisc+Z74nY5WUJggxYl3jkUKXAb8qMzlnk6k3hUerjgs/cRn4FqyCMTbh2qmh1w9/ HD4IHT/eVJtxNmmMBkXmObLAR+6LYjR15O/oVg2VYPyeDbppZ+8vls4T98T0qyzsGulY 1+0w== 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=LQjUgeOMe19KxGXlTyp39nYZgINBNkxraCApJwSubp8=; b=sjCI4yn4mI0a4qzpBf6QB3ASNrcRb9rLM5RYzNJvoLn8nnlEQA5Do99YvypGsybPUe F0IPW5qKmrMmBbEpVd6cjfxsPx1Jg/4f0/ATGRMggR+zEPdh8LcJt18bjdJkxL8O8jb4 5Xw4iT/iQyrldUuyQpCqkwFAznvkRevUq2USVC2VB11hX2DjgCY+dVcRIjuEkJHaPYzE rkEGW51/eFKtRcHjD2M+4p3GUQ78IkCMgILd8I0L/dvnl4ME3perL1QWriF9SD8gRaAM qgkLsqZ3JeGlpT/REDsmurcmHNV567WzQhgf8orchkDyLXSz0skI9r81lA4EyimL+u4f 3rIw== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IM9EGV6I; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@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=LQjUgeOMe19KxGXlTyp39nYZgINBNkxraCApJwSubp8=; b=ex927sqOMpA7Rdry8xpiB1BkfKmstqOv4i3opUzQ7PCfpi/vyPfAQ/ar1NfcIsjsdv A7yM2Gx20e4MxJxmqFDx4YYEbVd4WZOxFgAUZsF7dYk6ptre7cCy9Cc1tTNot3P0L4zl 54ZZO7i7zTW3hG/QDisrNFgun3ZYLqLxMvk1A= 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=LQjUgeOMe19KxGXlTyp39nYZgINBNkxraCApJwSubp8=; b=2LgysWa+nmgsFyV7OZfF9+B3p7/JdV9dspPhzgJrM6TxUkaGiLFE20wIjGdcoINooW yaanZApOS56VNDJNodWcr1u8nXKrIOcIt9taLZDdflWRXUpGJsSSGLmmNZ/zLEbWVmzs JtiY9BLpLv9obOb6aJECYmWiLAHCNfnMlezLkUkZpC5+s2RsqG2x+D5UdrJuDgIW43tj N7Kn2qy7Thh6SiZMWGw8XyAi0VF+BAgtaRbgePDzhgwJK/+8XkJdkaVQQa9u8fet+gGH NQtpaTeFCcR5TVn8Ygp+LbodfCOobxpxFd6wxXP/W2tp9BwoLMGsHLpi5jMiMrAfR8MT /eNA== X-Gm-Message-State: AOAM5318Vd54KCW7HE3ghprw07OfroGz7vaXybHWn8+MCpbDeYx0FbHa QT91kWkb1EluPdXbX4IwnZWAJpdD X-Google-Smtp-Source: ABdhPJzRSfeNYeqJQPO66ER5wJtGqb4Rb/bEjxvqQ6Bzm+/9Og8fRC/Ih7f4m2MEzJIegZ6Y9f4LUQ== X-Received: by 2002:a17:90b:1193:b0:1bc:1b5a:84e4 with SMTP id gk19-20020a17090b119300b001bc1b5a84e4mr6224492pjb.113.1646325474651; Thu, 03 Mar 2022 08:37:54 -0800 (PST) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a65:6697:0:b0:37c:63e5:142a with SMTP id b23-20020a656697000000b0037c63e5142als601544pgw.10.gmail; Thu, 03 Mar 2022 08:37:54 -0800 (PST) X-Received: by 2002:a05:6a00:188f:b0:4e1:a253:850c with SMTP id x15-20020a056a00188f00b004e1a253850cmr38995503pfh.61.1646325473882; Thu, 03 Mar 2022 08:37:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1646325473; cv=none; d=google.com; s=arc-20160816; b=f0JsYU0Zdoc2D861mWVwdVafSzvhhyHOAzT4n8DsM8m4xG/nOYnZmKbGRAW8pPBhOl S4WYXyDAiJ6GiUpUsPHaNteYnNCShUfx9Zj36RQvYm1lxm2yc7YCQzuz3UuBRtu3Xcon lmMwI1D19rMMl9fhYcfdyOwAdipNisonJvDJf+iQ8gBxrTR4s6La69CNybWbslH5M3xT BLBdleYMWKMUA9DzjC19wEil9lWzx1rXrvvdMgM8LCzQXVCKDnjh/969ccPhKdLCusVT R2NRfLMr8yeC6U/IQqqdXl/vY+4J4MnJAU1qoO3PDNKpdflQaE2ZijMu5g2SgvFi/uJ7 puag== 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=LqxMAJ8/uNH+xDV5ABc3SJFvaxw+zJIGqvUEcIBudhI=; b=yw+n6cufyq22d66xPLF7cSdwUiyny1dIP4z3TBcgJVDb+oVODi0wzBeEfjiSJwi13h drroHI+OUgzdZy8tLv9vlxadYMCimjMuxPbpcO9hLM/uOeXD/S4Ib5g10PRE+dpHQnyc 5gxIM6S2eWgfLCGClJg91Sq2UHjbjtY7woeG8PQI4SEO/SaGO9qYD+Cyzx4ERH2yfTzf YIiKi1CdLijNvkSYHIpJhkOy7g/rkTFUX/aJatlYtlLNCccoPyksLG+QodsFzcU5/adT tVFarxSWp/B8hhqxr5xX7rk4d5eGxp+W1x7s7/mcQk+V45r6iJHlXsfokx9fiu6mbz+i oIbw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=IM9EGV6I; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@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 w129-20020a626287000000b004f3bc62a679sor35139pfb.40.2022.03.03.08.37.53 for (Google Transport Security); Thu, 03 Mar 2022 08:37:53 -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:a05:6a00:1a56:b0:4f4:1a2a:6d1b with SMTP id h22-20020a056a001a5600b004f41a2a6d1bmr19378527pfv.65.1646325473491; Thu, 03 Mar 2022 08:37:53 -0800 (PST) Received: from localhost.localdomain ([2405:201:c00a:a0a9:4526:5253:a010:63f4]) by smtp.gmail.com with ESMTPSA id j20-20020a056a00235400b004e192221ec2sm3220983pfj.14.2022.03.03.08.37.45 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Mar 2022 08:37:53 -0800 (PST) From: Jagan Teki To: Marek Szyprowski , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Sam Ravnborg , Michael Nazzareno Trimarchi , Inki Dae Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki Subject: [PATCH v6 3/6] exynos: drm: dsi: Attach in_bridge in MIC driver Date: Thu, 3 Mar 2022 22:06:51 +0530 Message-Id: <20220303163654.3381470-4-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220303163654.3381470-1-jagan@amarulasolutions.com> References: <20220303163654.3381470-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=IM9EGV6I; spf=pass (google.com: domain of jagan@amarulasolutions.com designates 209.85.220.41 as permitted sender) smtp.mailfrom=jagan@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: , MIC drivers in the Exynos5433 display pipeline are already registered as bridge drivers and it is more advisable to attach the downstream bridge on the bridge attach call instead of doing the same in the DSI driver. This makes bridge attachment more meaningful and avoids the races during bridge function calls. So, move the bridge finding and drm_bridge_attach from DSI to MIC. Signed-off-by: Jagan Teki Acked-by: Marek Szyprowski Tested-by: Marek Szyprowski --- Changes for v6: - new patch drivers/gpu/drm/exynos/exynos_drm_dsi.c | 15 --------------- drivers/gpu/drm/exynos/exynos_drm_mic.c | 22 ++++++++++++++++++++++ 2 files changed, 22 insertions(+), 15 deletions(-) diff --git a/drivers/gpu/drm/exynos/exynos_drm_dsi.c b/drivers/gpu/drm/exynos/exynos_drm_dsi.c index b7d0a4aead0a..741c046513e8 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_dsi.c +++ b/drivers/gpu/drm/exynos/exynos_drm_dsi.c @@ -1660,11 +1660,6 @@ static int exynos_dsi_of_read_u32(const struct device_node *np, return ret; } -enum { - DSI_PORT_IN, - DSI_PORT_OUT -}; - static int exynos_dsi_parse_dt(struct exynos_dsi *dsi) { struct device *dev = dsi->dev; @@ -1695,8 +1690,6 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, struct exynos_dsi *dsi = dev_get_drvdata(dev); struct drm_encoder *encoder = &dsi->encoder; struct drm_device *drm_dev = data; - struct device_node *in_bridge_node; - struct drm_bridge *in_bridge; int ret; drm_simple_encoder_init(drm_dev, encoder, DRM_MODE_ENCODER_TMDS); @@ -1707,14 +1700,6 @@ static int exynos_dsi_bind(struct device *dev, struct device *master, if (ret < 0) return ret; - in_bridge_node = of_graph_get_remote_node(dev->of_node, DSI_PORT_IN, 0); - if (in_bridge_node) { - in_bridge = of_drm_find_bridge(in_bridge_node); - if (in_bridge) - drm_bridge_attach(encoder, in_bridge, NULL, 0); - of_node_put(in_bridge_node); - } - return mipi_dsi_host_register(&dsi->dsi_host); } diff --git a/drivers/gpu/drm/exynos/exynos_drm_mic.c b/drivers/gpu/drm/exynos/exynos_drm_mic.c index 32672bf8ae4a..9e06f8e2a863 100644 --- a/drivers/gpu/drm/exynos/exynos_drm_mic.c +++ b/drivers/gpu/drm/exynos/exynos_drm_mic.c @@ -102,6 +102,7 @@ struct exynos_mic { struct videomode vm; struct drm_encoder *encoder; struct drm_bridge bridge; + struct drm_bridge *next_bridge; bool enabled; }; @@ -298,12 +299,22 @@ static void mic_pre_enable(struct drm_bridge *bridge) static void mic_enable(struct drm_bridge *bridge) { } +static int mic_attach(struct drm_bridge *bridge, + enum drm_bridge_attach_flags flags) +{ + struct exynos_mic *mic = bridge->driver_private; + + return drm_bridge_attach(bridge->encoder, mic->next_bridge, + &mic->bridge, flags); +} + static const struct drm_bridge_funcs mic_bridge_funcs = { .disable = mic_disable, .post_disable = mic_post_disable, .mode_set = mic_mode_set, .pre_enable = mic_pre_enable, .enable = mic_enable, + .attach = mic_attach, }; static int exynos_mic_bind(struct device *dev, struct device *master, @@ -377,6 +388,7 @@ static int exynos_mic_probe(struct platform_device *pdev) { struct device *dev = &pdev->dev; struct exynos_mic *mic; + struct device_node *remote; struct resource res; int ret, i; @@ -420,6 +432,16 @@ static int exynos_mic_probe(struct platform_device *pdev) } } + remote = of_graph_get_remote_node(dev->of_node, 1, 0); + mic->next_bridge = of_drm_find_bridge(remote); + if (IS_ERR(mic->next_bridge)) { + DRM_DEV_ERROR(dev, "mic: Failed to find next bridge\n"); + ret = PTR_ERR(mic->next_bridge); + goto err; + } + + of_node_put(remote); + platform_set_drvdata(pdev, mic); mic->bridge.funcs = &mic_bridge_funcs;