From patchwork Fri Apr 29 08:53:58 2022 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Jagan Teki X-Patchwork-Id: 1926 Return-Path: X-Original-To: linux-amarula@patchwork.amarulasolutions.com Delivered-To: linux-amarula@patchwork.amarulasolutions.com Received: from mail-pg1-f198.google.com (mail-pg1-f198.google.com [209.85.215.198]) by ganimede.amarulasolutions.com (Postfix) with ESMTPS id 6BBD33F057 for ; Fri, 29 Apr 2022 10:56:09 +0200 (CEST) Received: by mail-pg1-f198.google.com with SMTP id z18-20020a631912000000b003a392265b64sf3577456pgl.2 for ; Fri, 29 Apr 2022 01:56:09 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1651222568; cv=pass; d=google.com; s=arc-20160816; b=Qz2j2pn8lED0i9zvLbOogcmM1r4M6VB8V3ZMk8af99lNWYjrcmZgW13pf0sfxLAjfU u/eswvovMR9h/JFpnR8gH7oELjXq73HiO/zL/IntLeuhOZtR2XBioizfFZq84qvKEVqr g01liJ4AaeRkYBj/8m7usoa8LdOfZxfNaGgy5dAyMPvoQXTFFf3ICDeIRNeH3gPCeNDe lG+NSfJaO0lox5SZACPOZMhA+HlBbrzxF8MK4h7usrDHzRjJSJZ4NLBOLXHfDRLDVkVr OVyba8f6ad6WGMibeSm3Eyp4GeD22BqoyhdQOhlLH1Pbq3Yr5PAGbc8LBR9qUafUHhdE +UNg== 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=I146zEDDosbwrEC01FhPJoaW1Dp1H9lfztpf58/Tgbo=; b=rHtlkWkw/M15KdgZKM3iOoO3z8LX/x5jaZGjHPtdZ5C50Elb/Yp9uLC+uUt3xLCIjn YmnzH2wuzRgrfnG5ece5aBETAM3ggQDjJQ52IsKhs0DfAsaLnXzhQnNRXLj3MqFFdW1K x9Ra/Br0goQQcQfbStGhgPpGRG6+eKDAMeRsc9tCBE/GiXoenoP4wAbVcXkeG2cm2b1U M+0IgH8TA6qp/Uu4WVIQ9nlGnWcobdLqOzwpMOznc2WdHthtapx9RmdvRGUxLZ9mitqc N7lkZ2bwV3Ax3jQTiere47X/9nOmI4xZMoTvlKKrDxoMx2QlQ1HZXMW6bt+3C2YG8rJ/ qLfg== ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SB8PJZQG; 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=I146zEDDosbwrEC01FhPJoaW1Dp1H9lfztpf58/Tgbo=; b=G7/UOiOI74hQFfAH2wi36dky4wT9N7+bTLM1U1UGi+PO/dpQ401YIl+RqvaOZvQ7t1 v9qg1RCNf8K5PohuKxzx2BM2UT+RmftYFW7BNlTKGrxkGeAfj6Lusaqv/V67VswRboHo +2Makmtp1kegthSZmCAHHTuiBaTtpteHN1v80= 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=I146zEDDosbwrEC01FhPJoaW1Dp1H9lfztpf58/Tgbo=; b=vlMexYSrqMjPmn3n96O/023Aoojzn4lFWcOepU9wOB36ybuSOqX5r6/1JVsA8Sbxf3 INFU3rmLaUbmpSokSTzqHn3fvHHxTxy9sPTjmSHpvO5mufEO/uMoM3cd0MydMuTvEWMp Rvu9rhxblngjXOQ9u7HKio/WlZXbwE0X3WlGQqIkWQR3+GXrPojsUIJWpokNMjXHno4r /NT1HkNkmE9FEuI/zU83igaHK96ruvALmM5wZm2ElMjqof3OIn7QR1LEL8B580LNvyvv YHAD0J2G8gEmDmluMmKNRE5pdN3YgiLdVR9SMgUapJPOP4vN6aGhj1I5xTcVBpy4rhBy ZXUA== X-Gm-Message-State: AOAM532GtNQfpfG76mS2JOuDlyEzrrL75YacN9oGlTeZEBVSHBOGAkLr qBVWIM3kqQF9uTtuQx4ZbloiD7NP X-Google-Smtp-Source: ABdhPJxrnvrsJg3RIxfafLenhTcQkHB2ZSUGbpIeARSZyhysz3Na+0kXtURLb3qp+Ew16WogmxAhGw== X-Received: by 2002:a63:a901:0:b0:3aa:1cb6:d44a with SMTP id u1-20020a63a901000000b003aa1cb6d44amr31182590pge.339.1651222568032; Fri, 29 Apr 2022 01:56:08 -0700 (PDT) X-BeenThere: linux-amarula@amarulasolutions.com Received: by 2002:a63:4a06:0:b0:3ab:6545:7f71 with SMTP id x6-20020a634a06000000b003ab65457f71ls942148pga.4.gmail; Fri, 29 Apr 2022 01:56:07 -0700 (PDT) X-Received: by 2002:a05:6a00:1749:b0:50a:8eed:b824 with SMTP id j9-20020a056a00174900b0050a8eedb824mr39044209pfc.50.1651222567253; Fri, 29 Apr 2022 01:56:07 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1651222567; cv=none; d=google.com; s=arc-20160816; b=KtWRiH6ezxPSrxfZyIzs1GR/Jys+VxUdYWyUvt2XB7uhOdfD+hNtV5phXdHEL5LrK0 AKqcNHklhsw2fhPd0GW4hifkAIPkJ5zxa82y0uFEVK0Ui5ib68ih67KtDmEk6G3hssLZ EVGnhSeV3zpU9Y2RNm/EGaCS0gHgbJmiUipHQahG3sHhk0vxvkazLUtsZk9AGs16yVIG XVzX7c4VHZoVOXT8Q32CfovXNOvkJpDKvKT/eFA47hf3TmYJIf5mbsf3L+sMJep/77WR w/Q9YkHLgB0gEPuq2Fdq1cWuAL53OVsReAgFY2q1QlGMLWe43KMlHJrJ94p/+aUAtmsP 3uyA== 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=vtAatQi32uY0Mr/+NfdPdeyNea4utijeqFZuOoc4TBU=; b=Kv2i4J7bwD5k+/JBdvNcbMoc1c4MvZoNQm1NMoirwbJribzcq12J5HSDRM0wWANTIh KQb7dSyfbUPvgl/f9WxHtoFiNunsy09RoDc5XEigp38Ss67Z4FK/HhKMtag61bHrfans /l+xP9wgCGTHKwGRtJQJWACfbva8jNc8pu9KVQWYY5k45bLluiVB3qLwfsM0qvH6xoCn L9aKvfPR835CVU/RvBOM0BJT7E8p3ghNX/uW4KPXYn1XwiqwPeGX/+Wczt8Nlswt+dV6 UHmWLOu7h1IdAxyyN3z+COFfeY8wQUYJv2TAE3Ei9+fq67BM8jm0B8k9s2nCkGlgjLVK DKlQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@amarulasolutions.com header.s=google header.b=SB8PJZQG; 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 98-20020a17090a0feb00b001cde2e78fd1sor3110328pjz.8.2022.04.29.01.56.07 for (Google Transport Security); Fri, 29 Apr 2022 01:56:07 -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:38ce:b0:1da:49fe:d04d with SMTP id nn14-20020a17090b38ce00b001da49fed04dmr2706556pjb.51.1651222566931; Fri, 29 Apr 2022 01:56:06 -0700 (PDT) Received: from localhost.localdomain ([2405:201:c00a:a0a9:b5c3:f85c:afa7:cae9]) by smtp.gmail.com with ESMTPSA id o2-20020a17090a4e8200b001d26f134e43sm9247781pjh.51.2022.04.29.01.56.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 29 Apr 2022 01:56:06 -0700 (PDT) From: Jagan Teki To: Linus Walleij , Maxime Ripard , Laurent Pinchart Cc: dri-devel@lists.freedesktop.org, linux-amarula@amarulasolutions.com, Jagan Teki , Jagan Teki Subject: [PATCH 2/2] Revert "drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge" Date: Fri, 29 Apr 2022 14:23:58 +0530 Message-Id: <20220429085358.1699141-2-jagan@amarulasolutions.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20220429085358.1699141-1-jagan@amarulasolutions.com> References: <20220429085358.1699141-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=SB8PJZQG; 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: , From: Jagan Teki commit <3d7039e1e649> ("drm: bridge: mcde_dsi: Switch to devm_drm_of_get_bridge") switched to devm_drm_of_get_bridge for looking up if child node has panel or bridge. However commit ("Revert "drm: of: Lookup if child node has panel or bridge") has reverted panel or bridge child node lookup from devm_drm_of_get_bridge as it breaks the non-trivial cases the first child node might not be a panel or bridge. So, revert this commit to switch the previous behavior of looking up child panel or bridge. Signed-off-by: Jagan Teki Reviewed-by: Linus Walleij --- drivers/gpu/drm/mcde/mcde_dsi.c | 44 ++++++++++++++++++++++++++++----- 1 file changed, 38 insertions(+), 6 deletions(-) diff --git a/drivers/gpu/drm/mcde/mcde_dsi.c b/drivers/gpu/drm/mcde/mcde_dsi.c index 083a4728654d..5651734ce977 100644 --- a/drivers/gpu/drm/mcde/mcde_dsi.c +++ b/drivers/gpu/drm/mcde/mcde_dsi.c @@ -19,6 +19,7 @@ #include #include #include +#include #include #include @@ -38,6 +39,7 @@ struct mcde_dsi { struct device *dev; struct mcde *mcde; struct drm_bridge bridge; + struct drm_panel *panel; struct drm_bridge *bridge_out; struct mipi_dsi_host dsi_host; struct mipi_dsi_device *mdsi; @@ -1071,7 +1073,9 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, struct drm_device *drm = data; struct mcde *mcde = to_mcde(drm); struct mcde_dsi *d = dev_get_drvdata(dev); - struct drm_bridge *bridge; + struct device_node *child; + struct drm_panel *panel = NULL; + struct drm_bridge *bridge = NULL; if (!of_get_available_child_count(dev->of_node)) { dev_info(dev, "unused DSI interface\n"); @@ -1096,10 +1100,37 @@ static int mcde_dsi_bind(struct device *dev, struct device *master, return PTR_ERR(d->lp_clk); } - bridge = devm_drm_of_get_bridge(dev, dev->of_node, 0, 0); - if (IS_ERR(bridge)) { - dev_err(dev, "error to get bridge\n"); - return PTR_ERR(bridge); + /* Look for a panel as a child to this node */ + for_each_available_child_of_node(dev->of_node, child) { + panel = of_drm_find_panel(child); + if (IS_ERR(panel)) { + dev_err(dev, "failed to find panel try bridge (%ld)\n", + PTR_ERR(panel)); + panel = NULL; + + bridge = of_drm_find_bridge(child); + if (!bridge) { + dev_err(dev, "failed to find bridge\n"); + return -EINVAL; + } + } + } + if (panel) { + bridge = drm_panel_bridge_add_typed(panel, + DRM_MODE_CONNECTOR_DSI); + if (IS_ERR(bridge)) { + dev_err(dev, "error adding panel bridge\n"); + return PTR_ERR(bridge); + } + dev_info(dev, "connected to panel\n"); + d->panel = panel; + } else if (bridge) { + /* TODO: AV8100 HDMI encoder goes here for example */ + dev_info(dev, "connected to non-panel bridge (unsupported)\n"); + return -ENODEV; + } else { + dev_err(dev, "no panel or bridge\n"); + return -ENODEV; } d->bridge_out = bridge; @@ -1122,7 +1153,8 @@ static void mcde_dsi_unbind(struct device *dev, struct device *master, { struct mcde_dsi *d = dev_get_drvdata(dev); - drm_bridge_remove(d->bridge_out); + if (d->panel) + drm_panel_bridge_remove(d->bridge_out); regmap_update_bits(d->prcmu, PRCM_DSI_SW_RESET, PRCM_DSI_SW_RESET_DSI0_SW_RESETN, 0); }