Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1840364pxb; Thu, 28 Oct 2021 11:00:34 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzIrBnQc2uJwWhHqkdxZJYj5GebPRGuqM8cw9EUfrQeEfu6ERVkDyyE0RVpNWsCr95wj1pJ X-Received: by 2002:a17:903:32c2:b0:140:4773:5734 with SMTP id i2-20020a17090332c200b0014047735734mr5182558plr.41.1635444034402; Thu, 28 Oct 2021 11:00:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1635444034; cv=none; d=google.com; s=arc-20160816; b=oFKSWEmGEhbXwl8gXsUrnhuiHjtKUhPXd8zmAW8YvrHdzOWXHF4cd4nUR0RAqhdXoD fBJ203xEN9fUMtW9thX/ABarAXA5aKWnboWgrrsdJk6OHihoniJB6ZbhzH0M6KH7axCH Gq9QrFAA4F/a47dGwepkbxTUAPyAfz/z/mL6WSEpYflZ1QMvObiI4yD8IzKa+awmqA/i UFCdj96iczOS2ku4vVMSvkZ2D1e6YoFBe2ZUzrWEx/u7hpmQx/rvzcvXYDxhs5WExmld KPNHILQbVwqGx8CQINdWBCHVfI7T0Sg9FHCBp+jJLBqXvJcwNyzABz4BlvDvzpD2ac9I BNZA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=qjf/e3Fv2k4EEbSdFoguOmcAgMO1giT3H2d5/yVOr6A=; b=w4Mv8zQDgiEeHb+rTti9++D91FBzRtNho/pzqPbLlPHepKaj0tI3myBwpnhr6Yd4tR nB93b+364YL5acF9Tkp8VZQ3doCZ+YTGx8Q14O04EOaukC4c4GvzzWBzo2ELL/Ki3etP FBPul7Mu4fF9lhurIWiqUeRnVqa/QEFtRHsR8u2tKMuEZ4ndlP1I7nBw9WbkfnQaXfBl 7UmaxFbZoYT5Ha5ikxUwFBg8LudcE3Vu5vIUnlWBVcCiHxlF7Py0J55cCKagPDc8gfX7 /U+9QfREOTrie7Xy7DT/txfFtNsry3MdjdOQ1qJL6VZ4Ehq5FhPVfCU8mYoYLtdndLVK 5xdg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AN7AEtaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id i12si1374280plb.382.2021.10.28.11.00.20; Thu, 28 Oct 2021 11:00:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@chromium.org header.s=google header.b=AN7AEtaN; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=chromium.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231383AbhJ1SBZ (ORCPT + 99 others); Thu, 28 Oct 2021 14:01:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51730 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231233AbhJ1SAs (ORCPT ); Thu, 28 Oct 2021 14:00:48 -0400 Received: from mail-pg1-x52e.google.com (mail-pg1-x52e.google.com [IPv6:2607:f8b0:4864:20::52e]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 48B8EC06122B for ; Thu, 28 Oct 2021 10:58:19 -0700 (PDT) Received: by mail-pg1-x52e.google.com with SMTP id 83so7156276pgc.8 for ; Thu, 28 Oct 2021 10:58:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=chromium.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=qjf/e3Fv2k4EEbSdFoguOmcAgMO1giT3H2d5/yVOr6A=; b=AN7AEtaN30Nyi+MwuHDw8qU04Itt2BNubkw+p1o82OfS3yqd2p8DCQOrwMpmV3XIhQ A1LoKCsbJTQwMM/cOZh6ZAH+xnmG37RzF304q7MOBL9fuPllxc9lQz3Se2w9SP/PN2rY YN0pB6v9vzYCchAAdTjpE9BNVd7xVBomRrmxU= 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:content-transfer-encoding; bh=qjf/e3Fv2k4EEbSdFoguOmcAgMO1giT3H2d5/yVOr6A=; b=scYZNl0riPKZjghopUJmXmDVU1eH0igTKwO7SWBZWjNUpTy4kFiVkHU0AkDDkFMtfR G+8emRo6HFZ60nGQZDC5t1Z3nhD06tLpLaais+YKjdhkzyGUIC//RN8np6Xw+TxZ2lY/ 3cUN6dxd38guc2byAnmsYPl+vPvkQzCz8z337bRQlq02E1FTopJL9arM/ByWN9pSI7+o BIIi1Te1cpmjjRAl7+MnhPIQsWKv9HmfuhfVgzqQNIDX1aLFSb0ZxaIEqbJYtoBdAzcm mDA4G/xa10ZR8zy//e/1RSWJSOFK4vpcSyHZpUpIEKW8KajRSaFqcEKD5YV5Vdc9kbTr 0n5w== X-Gm-Message-State: AOAM533XVPl8hSW5C7ByFXnON4eO+l/DQpbzGPoX8DONpTNVuA/7Mf2C 4GbxdEi4SH53wWeUWBBfNmsYag86UrC0Uw== X-Received: by 2002:a62:7dc7:0:b0:47e:50ae:b9eb with SMTP id y190-20020a627dc7000000b0047e50aeb9ebmr3900295pfc.77.1635443898562; Thu, 28 Oct 2021 10:58:18 -0700 (PDT) Received: from philipchen.mtv.corp.google.com ([2620:15c:202:201:9954:4c46:483e:f139]) by smtp.gmail.com with ESMTPSA id d14sm4312109pfu.124.2021.10.28.10.58.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Oct 2021 10:58:18 -0700 (PDT) From: Philip Chen To: LKML Cc: swboyd@chromium.org, dianders@chromium.org, Philip Chen , Andrzej Hajda , Daniel Vetter , David Airlie , Jernej Skrabec , Jonas Karlman , Laurent Pinchart , Neil Armstrong , Robert Foss , dri-devel@lists.freedesktop.org Subject: [PATCH v5 2/2] drm/bridge: parade-ps8640: Populate devices on aux-bus Date: Thu, 28 Oct 2021 10:58:11 -0700 Message-Id: <20211028105754.v5.2.I09899dea340f11feab97d719cb4b62bef3179e4b@changeid> X-Mailer: git-send-email 2.33.0.1079.g6e70778dc9-goog In-Reply-To: <20211028105754.v5.1.I828f5db745535fb7e36e8ffdd62d546f6d08b6d1@changeid> References: <20211028105754.v5.1.I828f5db745535fb7e36e8ffdd62d546f6d08b6d1@changeid> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Conventionally, panel is listed under the root of the device tree. When userland asks for display mode, ps8640 bridge is responsible for returning EDID when ps8640_bridge_get_edid() is called. Now enable a new option of listing panel under "aux-bus" of ps8640 bridge node in the device tree. In this case, panel driver can retrieve EDID by triggering AUX transactions, without ps8640_bridge_get_edid() calls at all. To prevent the "old" and "new" options from interfering with each other's logic flow, disable DRM_BRIDGE_OP_EDID when the new option is taken. Signed-off-by: Philip Chen Reviewed-by: Stephen Boyd --- In v4, I factored out the "ps8640_ensure_hpd" change and added it to patch 1/2 in this patch series. But I forgot to mention it in v4 change log. Edit v4 change log retroactively. In v3, I factored out the "put_sync_suspend" change and added it to patch 1/2 in this patch series. But I forgot to mention it in v3 change log. Edit v3 change log retroactively. (no changes since v4) Changes in v4: - Move the change of "ps8640_ensure_hpd" to patch 1/2 in this patch series. Changes in v3: - Fix when to call of_node_put() in ps8640_of_panel_on_aux_bus() - Move the change of "put_sync_suspend" to patch 1/2 in this patch series. Changes in v2: - Add of_node_put() calls in ps8640_of_panel_on_aux_bus() - Select DRM_DP_AUX_BUS for PS8640 driver in Kconfig drivers/gpu/drm/bridge/Kconfig | 1 + drivers/gpu/drm/bridge/parade-ps8640.c | 51 ++++++++++++++++++++------ 2 files changed, 40 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/bridge/Kconfig b/drivers/gpu/drm/bridge/Kconfig index 431b6e12a81f..61db5a66b493 100644 --- a/drivers/gpu/drm/bridge/Kconfig +++ b/drivers/gpu/drm/bridge/Kconfig @@ -182,6 +182,7 @@ config DRM_PARADE_PS8622 config DRM_PARADE_PS8640 tristate "Parade PS8640 MIPI DSI to eDP Converter" depends on OF + select DRM_DP_AUX_BUS select DRM_KMS_HELPER select DRM_MIPI_DSI select DRM_PANEL diff --git a/drivers/gpu/drm/bridge/parade-ps8640.c b/drivers/gpu/drm/bridge/parade-ps8640.c index 63a817d92c1d..448988d9eb41 100644 --- a/drivers/gpu/drm/bridge/parade-ps8640.c +++ b/drivers/gpu/drm/bridge/parade-ps8640.c @@ -14,6 +14,7 @@ #include #include +#include #include #include #include @@ -149,6 +150,23 @@ static inline struct ps8640 *aux_to_ps8640(struct drm_dp_aux *aux) return container_of(aux, struct ps8640, aux); } +static bool ps8640_of_panel_on_aux_bus(struct device *dev) +{ + struct device_node *bus, *panel; + + bus = of_get_child_by_name(dev->of_node, "aux-bus"); + if (!bus) + return false; + + panel = of_get_child_by_name(bus, "panel"); + of_node_put(bus); + if (!panel) + return false; + of_node_put(panel); + + return true; +} + static int ps8640_ensure_hpd(struct ps8640 *ps_bridge) { struct regmap *map = ps_bridge->regmap[PAGE2_TOP_CNTL]; @@ -555,17 +573,6 @@ static int ps8640_probe(struct i2c_client *client) if (!ps_bridge) return -ENOMEM; - /* port@1 is ps8640 output port */ - ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL); - if (ret < 0) - return ret; - if (!panel) - return -ENODEV; - - ps_bridge->panel_bridge = devm_drm_panel_bridge_add(dev, panel); - if (IS_ERR(ps_bridge->panel_bridge)) - return PTR_ERR(ps_bridge->panel_bridge); - ps_bridge->supplies[0].supply = "vdd33"; ps_bridge->supplies[1].supply = "vdd12"; ret = devm_regulator_bulk_get(dev, ARRAY_SIZE(ps_bridge->supplies), @@ -588,9 +595,16 @@ static int ps8640_probe(struct i2c_client *client) ps_bridge->bridge.funcs = &ps8640_bridge_funcs; ps_bridge->bridge.of_node = dev->of_node; - ps_bridge->bridge.ops = DRM_BRIDGE_OP_EDID; ps_bridge->bridge.type = DRM_MODE_CONNECTOR_eDP; + /* + * In the device tree, if panel is listed under aux-bus of the bridge + * node, panel driver should be able to retrieve EDID by itself using + * aux-bus. So let's not set DRM_BRIDGE_OP_EDID here. + */ + if (!ps8640_of_panel_on_aux_bus(&client->dev)) + ps_bridge->bridge.ops = DRM_BRIDGE_OP_EDID; + ps_bridge->page[PAGE0_DP_CNTL] = client; ps_bridge->regmap[PAGE0_DP_CNTL] = devm_regmap_init_i2c(client, ps8640_regmap_config); @@ -633,6 +647,19 @@ static int ps8640_probe(struct i2c_client *client) if (ret) return ret; + devm_of_dp_aux_populate_ep_devices(&ps_bridge->aux); + + /* port@1 is ps8640 output port */ + ret = drm_of_find_panel_or_bridge(np, 1, 0, &panel, NULL); + if (ret < 0) + return ret; + if (!panel) + return -ENODEV; + + ps_bridge->panel_bridge = devm_drm_panel_bridge_add(dev, panel); + if (IS_ERR(ps_bridge->panel_bridge)) + return PTR_ERR(ps_bridge->panel_bridge); + drm_bridge_add(&ps_bridge->bridge); ret = ps8640_bridge_host_attach(dev, ps_bridge); -- 2.33.0.1079.g6e70778dc9-goog