From patchwork Wed Aug 11 23:52:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 495216 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 8C9F7C4320A for ; Wed, 11 Aug 2021 23:51:13 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 6B09B6052B for ; Wed, 11 Aug 2021 23:51:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S232964AbhHKXvg (ORCPT ); Wed, 11 Aug 2021 19:51:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46248 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232970AbhHKXvb (ORCPT ); Wed, 11 Aug 2021 19:51:31 -0400 Received: from mail-pj1-x1035.google.com (mail-pj1-x1035.google.com [IPv6:2607:f8b0:4864:20::1035]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8A862C0613D5; Wed, 11 Aug 2021 16:51:07 -0700 (PDT) Received: by mail-pj1-x1035.google.com with SMTP id mq2-20020a17090b3802b0290178911d298bso7767434pjb.1; Wed, 11 Aug 2021 16:51:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=ajYbf81Yqy3WxYtrc+qNAd59M/DxRn0eX+jpAiWAdzU=; b=HFa/GpEZhGjw8e5u9UpZtdUaZYDPO2CUPmZsSq+o19AivoJl2fWAXdhJLHqwoU2Vbj pf+blzLQRJqfn6OKrZ7rZ9hFlKndZI7QB+4VDlmybyxpp65HOEwjPmnfWVEctyGnfgVC /KgKffkOHKtTyfKuQ3G5nDdjP7xBJcQYYlEppSLRxGTdveSrsvfHyHzD7qq2U+2bGI9D EaoFeDOBDuGbqjGtnbkkLnvtAbz3DE8P4ae8+Y2VyvLIdP4Tpo0/VND24bgkW1Nv3f62 Fj9Gb18fb6qwsNg3d6wn4HblHs4yo99aXnJEBr6hy5pbu8gh4Y9mUjnUaiJsikpIP8HS 9aeA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ajYbf81Yqy3WxYtrc+qNAd59M/DxRn0eX+jpAiWAdzU=; b=nWgbjMx1viF+FUYFakqrc/V1X24KMHtfIYxHqBMhkNKeQMDftwuxs3D0QraLyC3x0F 5GFXQce4ZEvF4aBQxkl/DPcTZ52llTfihYEYsai8zEePoCc3j9Fc+b3ySGrCauvR6YSS Q3YvadB3lT6W9EUTo0OezgxWnuYyf/z15yfwH8wsqya+WuAczOqF1/LYiBgQLEY7bL5F I1gGV72eexd6mjxq2If2J4byG9XyiAPdeJEECpCuQyS1nVt0THUp+Kt6wMCB3ybELLV6 7YJWyJDVqo1YqhgppkmtSkoYxU1/dOjo+NPIfZ4RQR8dhH5zTbUu38i8d0OMUXEImdXK 31eg== X-Gm-Message-State: AOAM531kV3OIMhrEmeu0qvM+3Vl2vIIgEo+2bQsCqnjqbM87Mi9YhCyG 8dMbdug8tXx0FET8pudJ5kI= X-Google-Smtp-Source: ABdhPJytzYhLMXUKv84A3eQfW76ypTSusumRwm/ejokVZS9tslD/F13P648Qt7+qeAfTTfxweVZ69w== X-Received: by 2002:a17:902:7889:b029:12b:cf54:4bf1 with SMTP id q9-20020a1709027889b029012bcf544bf1mr1233174pll.85.1628725867120; Wed, 11 Aug 2021 16:51:07 -0700 (PDT) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id 21sm714109pfh.103.2021.08.11.16.51.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 16:51:06 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Stephen Boyd , Douglas Anderson , Rob Clark , Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Dmitry Baryshkov , Abhinav Kumar , Bjorn Andersson , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 2/4] drm/msm/dsi: Support NO_CONNECTOR bridges Date: Wed, 11 Aug 2021 16:52:48 -0700 Message-Id: <20210811235253.924867-3-robdclark@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210811235253.924867-1-robdclark@gmail.com> References: <20210811235253.924867-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark For now, since we have a mix of bridges which support this flag, which which do *not* support this flag, or work both ways, try it once with NO_CONNECTOR and then fall back to the old way if that doesn't work. Eventually we can drop the fallback path. Signed-off-by: Rob Clark Reviewed-by: Laurent Pinchart --- drivers/gpu/drm/msm/Kconfig | 2 ++ drivers/gpu/drm/msm/dsi/dsi_manager.c | 41 ++++++++++++++++++--------- 2 files changed, 30 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/msm/Kconfig b/drivers/gpu/drm/msm/Kconfig index e9c6af78b1d7..36e5ba3ccc28 100644 --- a/drivers/gpu/drm/msm/Kconfig +++ b/drivers/gpu/drm/msm/Kconfig @@ -14,6 +14,8 @@ config DRM_MSM select REGULATOR select DRM_KMS_HELPER select DRM_PANEL + select DRM_BRIDGE + select DRM_PANEL_BRIDGE select DRM_SCHED select SHMEM select TMPFS diff --git a/drivers/gpu/drm/msm/dsi/dsi_manager.c b/drivers/gpu/drm/msm/dsi/dsi_manager.c index c41d39f5b7cf..1fd1cf93abbf 100644 --- a/drivers/gpu/drm/msm/dsi/dsi_manager.c +++ b/drivers/gpu/drm/msm/dsi/dsi_manager.c @@ -3,6 +3,8 @@ * Copyright (c) 2015, The Linux Foundation. All rights reserved. */ +#include "drm/drm_bridge_connector.h" + #include "msm_kms.h" #include "dsi.h" @@ -690,8 +692,7 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) struct drm_device *dev = msm_dsi->dev; struct drm_encoder *encoder; struct drm_bridge *int_bridge, *ext_bridge; - struct drm_connector *connector; - struct list_head *connector_list; + int ret; int_bridge = msm_dsi->bridge; ext_bridge = msm_dsi->external_bridge = @@ -699,22 +700,36 @@ struct drm_connector *msm_dsi_manager_ext_bridge_init(u8 id) encoder = msm_dsi->encoder; - /* link the internal dsi bridge to the external bridge */ - drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); - /* - * we need the drm_connector created by the external bridge - * driver (or someone else) to feed it to our driver's - * priv->connector[] list, mainly for msm_fbdev_init() + * Try first to create the bridge without it creating it's own + * connector.. currently some bridges support this, and others + * do not (and some support both modes) */ - connector_list = &dev->mode_config.connector_list; + ret = drm_bridge_attach(encoder, ext_bridge, int_bridge, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret == -EINVAL) { + struct drm_connector *connector; + struct list_head *connector_list; + + /* link the internal dsi bridge to the external bridge */ + drm_bridge_attach(encoder, ext_bridge, int_bridge, 0); + + /* + * we need the drm_connector created by the external bridge + * driver (or someone else) to feed it to our driver's + * priv->connector[] list, mainly for msm_fbdev_init() + */ + connector_list = &dev->mode_config.connector_list; + + list_for_each_entry(connector, connector_list, head) { + if (drm_connector_has_possible_encoder(connector, encoder)) + return connector; + } - list_for_each_entry(connector, connector_list, head) { - if (drm_connector_has_possible_encoder(connector, encoder)) - return connector; + return ERR_PTR(-ENODEV); } - return ERR_PTR(-ENODEV); + return drm_bridge_connector_init(dev, encoder); } void msm_dsi_manager_bridge_destroy(struct drm_bridge *bridge) From patchwork Wed Aug 11 23:52:50 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Rob Clark X-Patchwork-Id: 495215 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-15.7 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER,INCLUDES_PATCH, MAILING_LIST_MULTI, SPF_HELO_NONE, SPF_PASS, URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 6DC64C4320E for ; Wed, 11 Aug 2021 23:51:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 4D0DA6101E for ; Wed, 11 Aug 2021 23:51:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233019AbhHKXvi (ORCPT ); Wed, 11 Aug 2021 19:51:38 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:46272 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232948AbhHKXvf (ORCPT ); Wed, 11 Aug 2021 19:51:35 -0400 Received: from mail-pj1-x1036.google.com (mail-pj1-x1036.google.com [IPv6:2607:f8b0:4864:20::1036]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 962FBC061765; Wed, 11 Aug 2021 16:51:11 -0700 (PDT) Received: by mail-pj1-x1036.google.com with SMTP id a8so6267167pjk.4; Wed, 11 Aug 2021 16:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=04WJj5s3tctrSwR8Sz6N1WyD9Un9NfxweT900BICdVM=; b=ne9DzUb+oQO4z6rDjwVGCE9QmlLYsujxft75FhYrqw6dKpJVnnuAf4c+a7U+3CE3Pp M3V3z9TSE50E4H12+sSkPYWgBiqNmOoMkuu+FNSVD/NZeWsuCd1cfMoFsyBB//ayEBs7 CuIy1Znix+tRa6+ApM51ahJCVzMkSVP/gmo31jYDk6A/WOM973ZXwqTw/Fr27pYWm5PT widI0YQHAsDmBpolqOAz/YkViZfW5A82VJAQlrge7gYXZWdPJBOis8uzM20JYDlnFvBl 2n/qcGeZfV7jPa0C87rAdjZyN98MpEVZ+U4qwM3wtDsSx52nbMtuu/9s0ffZQEHGJShG wmdg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=04WJj5s3tctrSwR8Sz6N1WyD9Un9NfxweT900BICdVM=; b=GRNOjAZgnY7r4b2XtVd9M46vkZdEHOtBXeYHhWpyxTyNkcfh7Vp41bz82oeqtoT3bk kRd1NLT3B7zG6E+BOYMMb4nZg8zwKwj5o33V9GJYt27gYRRPlDYwiX4Z8sjXgs7n58LF Onl/Ho7AheusZzrz94IRdUCnRdM3WO+DRSjcKu7BdFFx/6UJ2UBslDHT9HXgZJZRjLRc yNmn1iOcR3Hi8heOxyeAQ2mc49sTNGr9JZHOxTIuhsuxDW5iqd2mLGBWYX2cYgowW6/l JK+tlMF4DZlBmKsw4q/uCeP41m/UOpC93lUF0r4zHWhx91Ub34x0kx2Km67u0jnBGIds ExAg== X-Gm-Message-State: AOAM533K/2it8XiSWqGHlMXl8aPyzf9XGHO9vNgLmtgBexpXquWIUlhe sb9CHFQ1pAp9u0USZWEdmkY= X-Google-Smtp-Source: ABdhPJw1q2RqS/5nMBmm9zC4l9pNzGk/XZcfLbMnn089P0iE1maQfoZnavDOwU1JF/CdkIXCuGM6Xw== X-Received: by 2002:a65:6441:: with SMTP id s1mr1164917pgv.214.1628725871203; Wed, 11 Aug 2021 16:51:11 -0700 (PDT) Received: from localhost (c-73-25-156-94.hsd1.or.comcast.net. [73.25.156.94]) by smtp.gmail.com with ESMTPSA id j16sm727463pfi.165.2021.08.11.16.51.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 11 Aug 2021 16:51:10 -0700 (PDT) From: Rob Clark To: dri-devel@lists.freedesktop.org Cc: linux-arm-msm@vger.kernel.org, freedreno@lists.freedesktop.org, Laurent Pinchart , Stephen Boyd , Douglas Anderson , Rob Clark , Andrzej Hajda , Neil Armstrong , Robert Foss , Laurent Pinchart , Jonas Karlman , Jernej Skrabec , David Airlie , Daniel Vetter , linux-kernel@vger.kernel.org (open list) Subject: [PATCH 4/4] drm/bridge: ti-sn65dsi86: Add NO_CONNECTOR support Date: Wed, 11 Aug 2021 16:52:50 -0700 Message-Id: <20210811235253.924867-5-robdclark@gmail.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210811235253.924867-1-robdclark@gmail.com> References: <20210811235253.924867-1-robdclark@gmail.com> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org From: Rob Clark Slightly awkward to fish out the display_info when we aren't creating own connector. But I don't see an obvious better way. Signed-off-by: Rob Clark Reviewed-by: Douglas Anderson --- drivers/gpu/drm/bridge/ti-sn65dsi86.c | 34 +++++++++++++++++++++++---- 1 file changed, 29 insertions(+), 5 deletions(-) diff --git a/drivers/gpu/drm/bridge/ti-sn65dsi86.c b/drivers/gpu/drm/bridge/ti-sn65dsi86.c index 38dcc49eccaf..dc8112bab3d3 100644 --- a/drivers/gpu/drm/bridge/ti-sn65dsi86.c +++ b/drivers/gpu/drm/bridge/ti-sn65dsi86.c @@ -693,9 +693,11 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, return ret; } - ret = ti_sn_bridge_connector_init(pdata); - if (ret < 0) - goto err_conn_init; + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) { + ret = ti_sn_bridge_connector_init(pdata); + if (ret < 0) + goto err_conn_init; + } /* * TODO: ideally finding host resource and dsi dev registration needs @@ -757,7 +759,8 @@ static int ti_sn_bridge_attach(struct drm_bridge *bridge, err_dsi_attach: mipi_dsi_device_unregister(dsi); err_dsi_host: - drm_connector_cleanup(&pdata->connector); + if (!(flags & DRM_BRIDGE_ATTACH_NO_CONNECTOR)) + drm_connector_cleanup(&pdata->connector); err_conn_init: drm_dp_aux_unregister(&pdata->aux); return ret; @@ -806,9 +809,30 @@ static void ti_sn_bridge_set_dsi_rate(struct ti_sn65dsi86 *pdata) regmap_write(pdata->regmap, SN_DSIA_CLK_FREQ_REG, val); } +/* + * Find the connector and fish out the bpc from display_info. It would + * be nice if we could get this instead from drm_bridge_state, but that + * doesn't yet appear to be the case. + */ static unsigned int ti_sn_bridge_get_bpp(struct ti_sn65dsi86 *pdata) { - if (pdata->connector.display_info.bpc <= 6) + struct drm_bridge *bridge = &pdata->bridge; + struct drm_connector_list_iter conn_iter; + struct drm_connector *connector; + unsigned bpc = 0; + + drm_connector_list_iter_begin(bridge->dev, &conn_iter); + drm_for_each_connector_iter(connector, &conn_iter) { + if (drm_connector_has_possible_encoder(connector, bridge->encoder)) { + bpc = connector->display_info.bpc; + break; + } + } + drm_connector_list_iter_end(&conn_iter); + + WARN_ON(bpc == 0); + + if (bpc <= 6) return 18; else return 24;