From patchwork Sat Oct 16 22:18:37 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515900 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279523imp; Sat, 16 Oct 2021 15:17:11 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzl4UysuLB2t7OjpUutDCUYfFpFAZYI5McgQmpZBKD13t8dIGpWvIIR3EAAgBZQEPvrWqrF X-Received: by 2002:a17:90a:6b4f:: with SMTP id x15mr37121407pjl.233.1634422631368; Sat, 16 Oct 2021 15:17:11 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422631; cv=none; d=google.com; s=arc-20160816; b=a9w73UlRK+haOiLtjPl+fkuNXxQSrVaPsZIef+Qkg9dUvwO+zCo2nh54ZL0mW+grwp L8UlfnNnrETYqTrwxcfnb/6mub6hPiRNHqy6Eu3t08yRjXyU6f+jhTEm1z5GNrHlEX2V WFaQ3jtdRmoO9xCGwMWKGtT2tfLkJWSjmRhGnvLz6biQZ0TuS1xj5mxYcOGAD/fOngm3 tQRNtbOKvIEVaOMqPw6bqogpI2rSJjx1RiAos5UEtRIWzmUeB4IXEoM8mS2d/cV5kCyQ rYPsvvchFExUwVmSHx7puiKN73uys4OYnUWoOlN0UpKXRtye9skHm4st+0eKp5XalU96 vgSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=aY5JCWeXUnthAVYpG6OQfZkw2dAIEZGPcRSTpOB0thE=; b=ARzTk6V0fzFEpd4Y/FBaDiDJAxGOxO2TiLH22baufRFHxoUVvxRwA5lORZoChB+ufs WhpyxKiiFQYowQkjCFUSKHb/daNpNpbRwmULcBuKV4W4FACB/p60gpBPQPnDV09JXqs+ y8sG5sY2QhSmYFkUdQyyuLArLU56AfHF6zPqBtjVaTA7BdFIOnAMGvtvwm7/HC30ySlQ YvT23lW+6+QelirhdBfu1F+NQBhMUGCXjVLZrS1YLYbY5+Q18B5yxPAZwmk2B8//flB+ C3tdxzu1EVarirB4y55rhXtQWN5hgtKv0NqTSd7pr3iuPKWiZN4y3P6a9a+UM0rubGuO qS+g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=da4w8Z53; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id z18si13108405pgj.8.2021.10.16.15.17.11 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:11 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=da4w8Z53; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 5E8FD6E8E3; Sat, 16 Oct 2021 22:16:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x32d.google.com (mail-ot1-x32d.google.com [IPv6:2607:f8b0:4864:20::32d]) by gabe.freedesktop.org (Postfix) with ESMTPS id DC02B6E8B9 for ; Sat, 16 Oct 2021 22:16:56 +0000 (UTC) Received: by mail-ot1-x32d.google.com with SMTP id l16-20020a9d6a90000000b0054e7ab56f27so835473otq.12 for ; Sat, 16 Oct 2021 15:16:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=aY5JCWeXUnthAVYpG6OQfZkw2dAIEZGPcRSTpOB0thE=; b=da4w8Z53Dgr/8mdTK97X5wOecVlIQxRCnMkSgG1ntROyrKsU4iyYDmggMdMlu40hYg NHmMJyImrY/s1NCKugBV0BeL8+T6HL3u5G1ac4j2+mDPrLfmRY8KWHcplOkQEHNWyrCE iAoXmFL2fp2AKzttdn3Qx3po7BnpUW/iS90WMzGA2ct297WM7fOxDQuSvJEi6jQ85noP xyGWyZ7gsrVZY/DnM3eNcmqOQ3BYRAddubgZ47ZwVRwu1Y+jZ2+rs7c6RX3yXbc7vRnQ SjL+5OUXAcWGDzFbgZp7PcJ4f/YxznEHjYlV64ZtiqPpELhxWBo9O+nP3RaH4uscW2ME 5pkg== 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=aY5JCWeXUnthAVYpG6OQfZkw2dAIEZGPcRSTpOB0thE=; b=M0t2tVhialRrB8BOmRQodVxN5J0u6YTpl3kFJSTwYBc5MgUdmq+Q/yFNMByVhu1zOJ J9DR1oTbVxFFsRwmIdg9S6u3fHzmZaOAiQriJBu/LdVc6ZNyGhM18SW+eVSy+EhcGcvu 4GW+HRxnV/PLnuiOqqF6oK0x++0gcEQn/8V+xgcUctuBOpVjlu8OlFfkAMOe7Y8FYBNN JCTMsQFOC59cBGDsX3XpMEoLoRpD3LmUUK0q6QJElzgeHk1Jhu0GUy/zLvZtJVXo2B5O BxFG0nCWhTBJ2mSGaD/nocCJjzfY6M/kDmCDxhHvlDaias9nbQSAs20MZC4SKolQ2qsm ZIOg== X-Gm-Message-State: AOAM533XmRyQu1PO4jVdvBMLyhvLxKY+IRvf9b7jIA+aJFh75aKRQTKd VlBWEd6ZsgOcYdTURoqkShNREw== X-Received: by 2002:a9d:458b:: with SMTP id x11mr14832941ote.86.1634422616127; Sat, 16 Oct 2021 15:16:56 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.55 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:55 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 1/7] drm/msm/dp: Remove global g_dp_display variable Date: Sat, 16 Oct 2021 15:18:37 -0700 Message-Id: <20211016221843.2167329-2-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As the Qualcomm DisplayPort driver only supports a single instance of the driver the commonly used struct dp_display is kept in a global variable. As we introduce additional instances this obviously doesn't work. Replace this with a combination of existing references to adjacent objects and drvdata. Reviewed-by: Abhinav Kumar Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson --- Changes since v4: - None drivers/gpu/drm/msm/dp/dp_display.c | 80 ++++++++--------------------- 1 file changed, 21 insertions(+), 59 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index fbe4c2cd52a3..5d3ee5ef07c2 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -27,7 +27,6 @@ #include "dp_audio.h" #include "dp_debug.h" -static struct msm_dp *g_dp_display; #define HPD_STRING_SIZE 30 enum { @@ -121,6 +120,13 @@ static const struct of_device_id dp_dt_match[] = { {} }; +static struct dp_display_private *dev_get_dp_display_private(struct device *dev) +{ + struct msm_dp *dp = dev_get_drvdata(dev); + + return container_of(dp, struct dp_display_private, dp_display); +} + static int dp_add_event(struct dp_display_private *dp_priv, u32 event, u32 data, u32 delay) { @@ -197,15 +203,12 @@ static int dp_display_bind(struct device *dev, struct device *master, void *data) { int rc = 0; - struct dp_display_private *dp; - struct drm_device *drm; + struct dp_display_private *dp = dev_get_dp_display_private(dev); struct msm_drm_private *priv; + struct drm_device *drm; drm = dev_get_drvdata(master); - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); - dp->dp_display.drm_dev = drm; priv = drm->dev_private; priv->dp = &(dp->dp_display); @@ -240,13 +243,10 @@ static int dp_display_bind(struct device *dev, struct device *master, static void dp_display_unbind(struct device *dev, struct device *master, void *data) { - struct dp_display_private *dp; + struct dp_display_private *dp = dev_get_dp_display_private(dev); struct drm_device *drm = dev_get_drvdata(master); struct msm_drm_private *priv = drm->dev_private; - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); - dp_power_client_deinit(dp->power); dp_aux_unregister(dp->aux); priv->dp = NULL; @@ -379,38 +379,17 @@ static void dp_display_host_deinit(struct dp_display_private *dp) static int dp_display_usbpd_configure_cb(struct device *dev) { - int rc = 0; - struct dp_display_private *dp; - - if (!dev) { - DRM_ERROR("invalid dev\n"); - rc = -EINVAL; - goto end; - } - - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); + struct dp_display_private *dp = dev_get_dp_display_private(dev); dp_display_host_init(dp, false); - rc = dp_display_process_hpd_high(dp); -end: - return rc; + return dp_display_process_hpd_high(dp); } static int dp_display_usbpd_disconnect_cb(struct device *dev) { int rc = 0; - struct dp_display_private *dp; - - if (!dev) { - DRM_ERROR("invalid dev\n"); - rc = -EINVAL; - return rc; - } - - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); + struct dp_display_private *dp = dev_get_dp_display_private(dev); dp_add_event(dp, EV_USER_NOTIFICATION, false, 0); @@ -472,15 +451,7 @@ static int dp_display_usbpd_attention_cb(struct device *dev) { int rc = 0; u32 sink_request; - struct dp_display_private *dp; - - if (!dev) { - DRM_ERROR("invalid dev\n"); - return -EINVAL; - } - - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); + struct dp_display_private *dp = dev_get_dp_display_private(dev); /* check for any test request issued by sink */ rc = dp_link_process_request(dp->link); @@ -647,7 +618,7 @@ static int dp_hpd_unplug_handle(struct dp_display_private *dp, u32 data) DRM_DEBUG_DP("hpd_state=%d\n", state); /* signal the disconnect event early to ensure proper teardown */ - dp_display_handle_plugged_change(g_dp_display, false); + dp_display_handle_plugged_change(&dp->dp_display, false); /* enable HDP plug interrupt to prepare for next plugin */ dp_catalog_hpd_config_intr(dp->catalog, DP_DP_HPD_PLUG_INT_MASK, true); @@ -842,9 +813,7 @@ static int dp_display_prepare(struct msm_dp *dp) static int dp_display_enable(struct dp_display_private *dp, u32 data) { int rc = 0; - struct msm_dp *dp_display; - - dp_display = g_dp_display; + struct msm_dp *dp_display = &dp->dp_display; DRM_DEBUG_DP("sink_count=%d\n", dp->link->sink_count); if (dp_display->power_on) { @@ -880,9 +849,7 @@ static int dp_display_post_enable(struct msm_dp *dp_display) static int dp_display_disable(struct dp_display_private *dp, u32 data) { - struct msm_dp *dp_display; - - dp_display = g_dp_display; + struct msm_dp *dp_display = &dp->dp_display; if (!dp_display->power_on) return 0; @@ -1237,14 +1204,13 @@ static int dp_display_probe(struct platform_device *pdev) } mutex_init(&dp->event_mutex); - g_dp_display = &dp->dp_display; /* Store DP audio handle inside DP display */ - g_dp_display->dp_audio = dp->audio; + dp->dp_display.dp_audio = dp->audio; init_completion(&dp->audio_comp); - platform_set_drvdata(pdev, g_dp_display); + platform_set_drvdata(pdev, &dp->dp_display); rc = component_add(&pdev->dev, &dp_display_comp_ops); if (rc) { @@ -1257,10 +1223,7 @@ static int dp_display_probe(struct platform_device *pdev) static int dp_display_remove(struct platform_device *pdev) { - struct dp_display_private *dp; - - dp = container_of(g_dp_display, - struct dp_display_private, dp_display); + struct dp_display_private *dp = dev_get_dp_display_private(&pdev->dev); dp_display_deinit_sub_modules(dp); @@ -1315,8 +1278,7 @@ static int dp_pm_resume(struct device *dev) else dp->dp_display.is_connected = false; - dp_display_handle_plugged_change(g_dp_display, - dp->dp_display.is_connected); + dp_display_handle_plugged_change(dp_display, dp->dp_display.is_connected); DRM_DEBUG_DP("After, sink_count=%d is_connected=%d core_inited=%d power_on=%d\n", dp->link->sink_count, dp->dp_display.is_connected, From patchwork Sat Oct 16 22:18:38 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515901 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279551imp; Sat, 16 Oct 2021 15:17:15 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyxou5onGnLy2cMkcTDorWNNEKDot5T3279pZbTVinGRSyZFnvVZInqi3HqVPyuS0oqwjlJ X-Received: by 2002:a62:3802:0:b0:44c:776b:f555 with SMTP id f2-20020a623802000000b0044c776bf555mr19240502pfa.82.1634422635002; Sat, 16 Oct 2021 15:17:15 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422634; cv=none; d=google.com; s=arc-20160816; b=pGNnx4ISFSiSNF5RHqacKmzCiKwqGzyso4ta5NfvYLnsmI/4pFRsiIopAjSsbWG35s W0U5ZM4sY5AhHCcIrd358xMkGnVZdALxS1478hfliXVxX9y33VVfLB77VLE4/CCvVSen +sDHvSjvOl6o4W/BfrPVoi0ZYj6HckcQ3MZYnhEHcSt6CUb/O78OUdlCuy+DuS3+JHDG wP+TMy/tB4m21pVotJLshsW4Wv7kGokCD0vyYCcrIW4PNq1thezApAOrwpntuXKti+OD a4ZwJ9DOx4Y0O0zUane4LutJvMOr0JiOkylUAapNWlQbn1NCrSHWuYgSEbIaHakdGiLo dMww== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=Lsn56pxPLZU351QYQn0nyUl+5C+c+5Byaba7lRhCMeo=; b=GzXwkMywBxAJhYAYBgUPYlFuROrHI27XRtw6n6THxNgJttOnyKQdeweqgUvKKRtOIK iE0EO6JMhlGh55ygjHDT2y3XV8YW6AlM5bboSlLPVx9MI8+IENudAjRBm9xA226Bewfa /Lgrf8HpiBCsOHq8/zrQHICp/cnDk0pvRr0njDRyskH0USOOafVPbyURWdHs/jM1brs7 CSWX/wLVl74CMFU9/mO8GN+Z1AtBS8DvddMIWGpAxDl1T7lpwOSmTmG/TxWCmgRR8jan SuIZMJSb+YD/Hdh9zSwoNzdZwOoQYzFX9pDVmaoGI3rGvk39n7U1iou2ek7N/NS0SMEt V39Q== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PSfhPtYR; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id h5si13955692pfv.258.2021.10.16.15.17.14 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:14 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=PSfhPtYR; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id DC8856E8DD; Sat, 16 Oct 2021 22:16:59 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oo1-xc2e.google.com (mail-oo1-xc2e.google.com [IPv6:2607:f8b0:4864:20::c2e]) by gabe.freedesktop.org (Postfix) with ESMTPS id CCBE36E8DD for ; Sat, 16 Oct 2021 22:16:57 +0000 (UTC) Received: by mail-oo1-xc2e.google.com with SMTP id w9-20020a4adec9000000b002b696945457so4254273oou.10 for ; Sat, 16 Oct 2021 15:16:57 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Lsn56pxPLZU351QYQn0nyUl+5C+c+5Byaba7lRhCMeo=; b=PSfhPtYRVYX4Ue7DIC7G/NdehnLVI1sh2DUAUD/5NLhVk+liaHLuEhvdy8STPhDgAQ Z8MBp6rcDneZUl4DXuOX4Tg/C7u696tqCejhmZxi0mno9V2ZvK+CfL8kO1gqsIWTt1lm lpe5JD50gmAF2/QiFi4B+jOrxuj8CXTvBFh4myZluL4aBQEZyUyraUT8wbl2sM+tCKwp fdlSvxGusYYcaFZwIOTTygQXrxwTutr7EIGpQeHVjH1VgU3CsbMsFEu1WrihW/i743OS QVlH873sg0cIOmSRD2GJYX5fvOfGyUi4HT7JzMJ1lZFA+uYll424jMdIRvxjX15Lzrc8 a3IQ== 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=Lsn56pxPLZU351QYQn0nyUl+5C+c+5Byaba7lRhCMeo=; b=H3Vuv0dB0pmIG5SfSjU5sO492lxRzdPIbWaVqZ2BznaTPkO7B1FKd2dn/l+TBDfsMv uLv5gwbC1olJaCm3hcS7/leZgMog0dBfvyp5LU1Phm6M0E+CZ3OXEfiVMqm5xrE73Kuj EQoYNzQiZmhbVkdJsEpDW0LrOQXR8uOiZZJoHkEWAGSEnhXeeWIpeZrv7OSPBBrFfhVz mVY8u33IjN3jquGWz3cEwVPd9d3OjiTn2l0dEr/s0tUdzssWUcFys1C7WAEPHt1DA0Ef UZmJuDNA0KafIxV4U3EAyXedKy6gTAVlewq1aKz9Y9ht+WQZTr5P2PDosSzxRNotlgUY WDXw== X-Gm-Message-State: AOAM53310/X2fD6/Km5VFNaUh+DD8tvpMn/KjQdWdLVuEu5ZbdOYRv7i dRAMA91XdXt/8dkWDAYi2aamwA== X-Received: by 2002:a4a:b501:: with SMTP id r1mr15021788ooo.20.1634422617017; Sat, 16 Oct 2021 15:16:57 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.56 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:56 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 2/7] drm/msm/dp: Modify prototype of encoder based API Date: Sat, 16 Oct 2021 15:18:38 -0700 Message-Id: <20211016221843.2167329-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Functions in the DisplayPort code that relates to individual instances (encoders) are passed both the struct msm_dp and the struct drm_encoder. But in a situation where multiple DP instances would exist this means that the caller need to resolve which struct msm_dp relates to the struct drm_encoder at hand. Store a reference to the struct msm_dp associated with each dpu_encoder_virt to allow the particular instance to be associate with the encoder in the following patch. Reviewed-by: Abhinav Kumar Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson --- Changes since v4: - None drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.29.2 diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index 0e9d3fa1544b..b7f33da2799c 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -168,6 +168,7 @@ enum dpu_enc_rc_states { * @vsync_event_work: worker to handle vsync event for autorefresh * @topology: topology of the display * @idle_timeout: idle timeout duration in milliseconds + * @dp: msm_dp pointer, for DP encoders */ struct dpu_encoder_virt { struct drm_encoder base; @@ -206,6 +207,8 @@ struct dpu_encoder_virt { struct msm_display_topology topology; u32 idle_timeout; + + struct msm_dp *dp; }; #define to_dpu_encoder_virt(x) container_of(x, struct dpu_encoder_virt, base) @@ -1000,8 +1003,8 @@ static void dpu_encoder_virt_mode_set(struct drm_encoder *drm_enc, trace_dpu_enc_mode_set(DRMID(drm_enc)); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) - msm_dp_display_mode_set(priv->dp, drm_enc, mode, adj_mode); + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) + msm_dp_display_mode_set(dpu_enc->dp, drm_enc, mode, adj_mode); list_for_each_entry(conn_iter, connector_list, head) if (conn_iter->encoder == drm_enc) @@ -1182,9 +1185,8 @@ static void dpu_encoder_virt_enable(struct drm_encoder *drm_enc) _dpu_encoder_virt_enable_helper(drm_enc); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - ret = msm_dp_display_enable(priv->dp, - drm_enc); + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + ret = msm_dp_display_enable(dpu_enc->dp, drm_enc); if (ret) { DPU_ERROR_ENC(dpu_enc, "dp display enable failed: %d\n", ret); @@ -1224,8 +1226,8 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) /* wait for idle */ dpu_encoder_wait_for_event(drm_enc, MSM_ENC_TX_COMPLETE); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - if (msm_dp_display_pre_disable(priv->dp, drm_enc)) + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + if (msm_dp_display_pre_disable(dpu_enc->dp, drm_enc)) DPU_ERROR_ENC(dpu_enc, "dp display push idle failed\n"); } @@ -1253,8 +1255,8 @@ static void dpu_encoder_virt_disable(struct drm_encoder *drm_enc) DPU_DEBUG_ENC(dpu_enc, "encoder disabled\n"); - if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS && priv->dp) { - if (msm_dp_display_disable(priv->dp, drm_enc)) + if (drm_enc->encoder_type == DRM_MODE_ENCODER_TMDS) { + if (msm_dp_display_disable(dpu_enc->dp, drm_enc)) DPU_ERROR_ENC(dpu_enc, "dp display disable failed\n"); } @@ -2170,7 +2172,8 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, timer_setup(&dpu_enc->vsync_event_timer, dpu_encoder_vsync_event_handler, 0); - + else if (disp_info->intf_type == DRM_MODE_ENCODER_TMDS) + dpu_enc->dp = priv->dp; INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, dpu_encoder_off_work); From patchwork Sat Oct 16 22:18:39 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515902 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279583imp; Sat, 16 Oct 2021 15:17:18 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz1/LhtAe/3O0O3Qb6FELaVpHNEsLzeyh8CtSoCEofQU4j8FNgLwpc3hnZuBFglcNBqwY+x X-Received: by 2002:a17:903:1c7:b0:13e:d05b:ed09 with SMTP id e7-20020a17090301c700b0013ed05bed09mr18486759plh.52.1634422638490; Sat, 16 Oct 2021 15:17:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422638; cv=none; d=google.com; s=arc-20160816; b=GvQjrKsqIyLhfxT5Vvjoiq17HiSzcnZR18KkGLpbtKF+UQNZjlUxAfC+k7dmpYA/Yo xKGbx9jvihUGLdDwiBaPSubtu7q+YgkwjEYcWajZ7TJtr9sYRbASl0WPBo07QhwAOytX cNm+RTYdBaR206PUeAiMdR9aAuHIEUUjykSB2/TQGvISdDW5ioUUdo8qlL2pfBrv+XQH OPLNpPXYcl9zmXDT6JtFpBOl4T1hCoUCwiz6ZHaaM7jtwuKaeFikmBESWfUDD3wMQHto jLe2kCNvCsGYBdUbcXI3HBmRvRscf1pmKd8f0FLW/vtzsgRrIGMpgUU4t7Fr0zidFc1r GkXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=fkBQdposgTBxUgd+a5IdIC+wjJ9I6jZT4eXu1D80xblkZFuV6kAT34GgqQ823Vj3JE lTtgYkjHBrFO+x0hDzTGdd932UI92q8XcvSJbZjWn5oLreRHY+8RadapuCeS7m8qnxrh s8q36OlOLs06aslTHrk0p++ilEFoAjRDSZrp/leGFH7Ze3+exBB9X624/JRx+2G38wfD XId0FP2z/qepsOnpOLD/DqiKtsMJJze7FQS9w4EY5NYCm1JtBA89NkuZcV7K0fxvhjCn 0+3N9iK3tOhsQm9MuLHMlUnqJk8Tf/7qR10F2aP6b62m35e/hl5GNpwXBtWjoJFdtkYd 4FHg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YrmKUcV7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id o14si12402328pll.87.2021.10.16.15.17.18 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:18 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=YrmKUcV7; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 7678A6E8EC; Sat, 16 Oct 2021 22:17:00 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x32a.google.com (mail-ot1-x32a.google.com [IPv6:2607:f8b0:4864:20::32a]) by gabe.freedesktop.org (Postfix) with ESMTPS id A41806E8E8 for ; Sat, 16 Oct 2021 22:16:58 +0000 (UTC) Received: by mail-ot1-x32a.google.com with SMTP id w12-20020a056830410c00b0054e7ceecd88so584579ott.2 for ; Sat, 16 Oct 2021 15:16:58 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=YrmKUcV7WuxXB+t/OZ4842VQRF3FlgSqUZUl5VqT9vxRkAXHbyF0ffYQ5T/1Itw8oS mjIhwyWIhnfHmtNhg6bSefMQr6gMLGEnDKEmT3o1G2T9O9VPdM2yWm8MQlHGOM9X+50D MU4UWk4kEEAKfcH7MQv489gEi2MEJt0iAh3NQAlDI6xeqc7yrG6NOMsNrAkkNfLi/CdP eTfci3BxSdxGra+jkaKHhfUrn9XsLlBjPDcETUjKii1hErQ6pDqbfpV4d1QxPmPLnk0d GmNuE5Ow/cP38eqchf7fXogHkhWnJZImo4iribnAkuQE3ux2T7jZkQVje3LfUzOYEFvE UW2w== 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=Y3JSg0yjBHrIT9e1qqj+dh8glMv7U4JrsszeYJgzm9Q=; b=gq3JcDckN7H4bc3jezdYHQlJ800qaAiQ7K8oHZDDLCQMf7dkFaO03oZ5+DIq1q1oCo Y9LA7DSZeiwaRygCYTzswf4BoyCymz4C+kuyZRk4ZYF8r4TaM9m/9hrV/MqKX8gukbOA ZTMWrgMymLFQDUgIJTOxeHpXKy4rsvqNYFJS30hk5oAhBI4bB9392ad1uispI6YhlK8y GLOyzmeD7Oh3dWVmHdrvDxY6vPqVj515GsL104fKKp7VdPnFk0mcCelObZEDsKpFwqxR g9J1VXoatJJl1F7DrnXrb0M7XSgeQnO7ESo9qQO7daVa+gBgl1P+B1pQmyp4UfGMgJK4 hipw== X-Gm-Message-State: AOAM533ZqDcsnnYAihV++2rkAraCLH90FNwY467ldSomxHVDJ6zLcyVU nYoVjwhPMRuHDf2X6YtxLE01vw== X-Received: by 2002:a9d:60d9:: with SMTP id b25mr15175971otk.378.1634422617920; Sat, 16 Oct 2021 15:16:57 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.57 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:57 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 3/7] drm/msm/dp: Allow specifying connector_type per controller Date: Sat, 16 Oct 2021 15:18:39 -0700 Message-Id: <20211016221843.2167329-4-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" As the following patches introduced support for multiple DP blocks in a platform and some of those block might be eDP it becomes useful to be able to specify the connector type per block. Although there's only a single block at this point, the array of descs and the search in dp_display_get_desc() are introduced here to simplify the next patch, that does introduce support for multiple DP blocks. Signed-off-by: Bjorn Andersson --- Changes since v4: - const the various struct msm_dp_desc instances - unsigned the connector_type The references to DRM_MODE_CONNECTOR_DisplayPort in dp_debug.c, that was highligted in the review of v4 has been removed in a separate patch. drivers/gpu/drm/msm/dp/dp_display.c | 43 ++++++++++++++++++++++++++++- drivers/gpu/drm/msm/dp/dp_display.h | 1 + drivers/gpu/drm/msm/dp/dp_drm.c | 2 +- 3 files changed, 44 insertions(+), 2 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 5d3ee5ef07c2..6913970c8cf9 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -115,8 +115,25 @@ struct dp_display_private { struct dp_audio *audio; }; +struct msm_dp_desc { + phys_addr_t io_start; + unsigned int connector_type; +}; + +struct msm_dp_config { + const struct msm_dp_desc *descs; + size_t num_descs; +}; + +static const struct msm_dp_config sc7180_dp_cfg = { + .descs = (const struct msm_dp_desc[]) { + { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, + }, + .num_descs = 1, +}; + static const struct of_device_id dp_dt_match[] = { - {.compatible = "qcom,sc7180-dp"}, + { .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_cfg }, {} }; @@ -1180,10 +1197,29 @@ int dp_display_request_irq(struct msm_dp *dp_display) return 0; } +static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev) +{ + const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev); + struct resource *res; + int i; + + res = platform_get_resource(pdev, IORESOURCE_MEM, 0); + if (!res) + return NULL; + + for (i = 0; i < cfg->num_descs; i++) + if (cfg->descs[i].io_start == res->start) + return &cfg->descs[i]; + + dev_err(&pdev->dev, "unknown displayport instance\n"); + return NULL; +} + static int dp_display_probe(struct platform_device *pdev) { int rc = 0; struct dp_display_private *dp; + const struct msm_dp_desc *desc; if (!pdev || !pdev->dev.of_node) { DRM_ERROR("pdev not found\n"); @@ -1194,8 +1230,13 @@ static int dp_display_probe(struct platform_device *pdev) if (!dp) return -ENOMEM; + desc = dp_display_get_desc(pdev); + if (!desc) + return -EINVAL; + dp->pdev = pdev; dp->name = "drm_dp"; + dp->dp_display.connector_type = desc->connector_type; rc = dp_init_sub_modules(dp); if (rc) { diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 8b47cdabb67e..75fcabcfbbdd 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -18,6 +18,7 @@ struct msm_dp { bool is_connected; bool audio_enabled; bool power_on; + unsigned int connector_type; hdmi_codec_plugged_cb plugged_cb; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index 764f4b81017e..f33e31523f56 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -147,7 +147,7 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) ret = drm_connector_init(dp_display->drm_dev, connector, &dp_connector_funcs, - DRM_MODE_CONNECTOR_DisplayPort); + dp_display->connector_type); if (ret) return ERR_PTR(ret); From patchwork Sat Oct 16 22:18:40 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515905 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279662imp; Sat, 16 Oct 2021 15:17:27 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyrgl4QsBjtlCSXene+T+UU/ilbsa0mHi9S7FG7+/6eauvFPLqOvkhjCmlzv6lyhKjjYTjE X-Received: by 2002:a17:902:c20c:b0:13a:3f4a:db58 with SMTP id 12-20020a170902c20c00b0013a3f4adb58mr18298147pll.12.1634422647428; Sat, 16 Oct 2021 15:17:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422647; cv=none; d=google.com; s=arc-20160816; b=VlpS9tQ/KhOqDOlrCMLM6fzD3SXGWyNrtE4XlmVnPhnNEJhSWjiUqfjdVHkl2HXlRN MPYemItmlGsa+GW7PnRSSJ8H807XyN8Hzn/bfAFCwLGS5Db+fJBLjZIDVrcSlgPFe6iN yzivzPShxv6dTF3PwU4MNXxowvBM9e1KRhR81j7whPoD/vHQWLPXaNEBXBuizEPRO5+u I1haH6ZlB1oVxxxh/c+qA4VINhCqENyOK+YLrn2eSnoE0MSAkeNwFC4o+dLWGIHDgzsw m4AsmYF1dMsQFN2oM58TTOS6xFk8KmIZUqETEge1KsMU351x79Ejb8d3xBhirdoDIEbk 1WFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=j8CkjnvD4XYRJbxbrS217o1yjl7s34UqdCCgpWSb1Mk=; b=aA4xuRVWZ3kMCbupVheg1u7Wt5NUtIg4CAewmSK2aC+YCWKrbZPuxR3G2sM9kSldCD 3z7NdOoGGkN57qsYrKoFbuqHzGSYYOFzajFkWruAVfK7JNusosHsNdJj9XskgVK8bOgP aoNlSOYOXlNc0mSl9zuleuOrs4+mMM77yauuco6bQE0mUmJs96Nk1JV0ghwemL+W/3XF zcfuqbo0m1oBGqfz1tcALzbz1qmuAyjbxIBr14cs0+xvS5Q//pSwIChIlN2muw0U3uGD NH0+nhq9LS3FjmjCdYgeKyz7VcT3d8LUvzDks98CD55E9clyyX0UyQQpljjGy66IotR4 pN8g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AwNEKj9p; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id c4si14532609plg.374.2021.10.16.15.17.27 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:27 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=AwNEKj9p; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 172996E8F6; Sat, 16 Oct 2021 22:17:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x329.google.com (mail-ot1-x329.google.com [IPv6:2607:f8b0:4864:20::329]) by gabe.freedesktop.org (Postfix) with ESMTPS id 8D7A36E8E8 for ; Sat, 16 Oct 2021 22:16:59 +0000 (UTC) Received: by mail-ot1-x329.google.com with SMTP id x33-20020a9d37a4000000b0054733a85462so181975otb.10 for ; Sat, 16 Oct 2021 15:16:59 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=j8CkjnvD4XYRJbxbrS217o1yjl7s34UqdCCgpWSb1Mk=; b=AwNEKj9pbK/6em9liphva8EPTdEhaVRayPPdnsAA6F/l6pw8BaPCPLNq8bUoVeXjWQ Nw4FQj+jSQhS8ILFhIvZYoUDCQj9EY6nzxLW7Mq4V+hc0nfU1IN/PYnrDOu7WFNdwYV8 ESvgmjqGlyDtGmcPr7J9dMq54Dvwm27Sq16AegCuDSxdx8OJodxBGOWibYukb6zB9/Cj d7mjEGc5HKbgIMT659oc/daYTQxQO4n+wfZVgcf7BdRnMFvgcRnG3bCfMmS76TjXm7Ij Hi+ExykxQHHt/WvU9PA/FzGDhMyNAMesFXpYekBR7qDQOjI15PMzaA352oFoVgr0VB5g E18A== 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=j8CkjnvD4XYRJbxbrS217o1yjl7s34UqdCCgpWSb1Mk=; b=U71LO+ANPGhjY9u9ZjOwCRxSCh2vMClKkdjw0oXDbh9p02e1GH9buhe/qLILCJLoTF NUWszgD+8agozazWJMmMCIBqs6+5jXo9LoC8xqrjDJ95+aXpiXV+sSXVGDIdJ2bIJnq8 DhhhvSaQdoDAUM4lqDKnyAJI2FziWES8X4gL8NXk/s2yxg0+tap3u4eOrG4MksMNlZj/ +2Vzkyf4vi9/x56URI1m6SwGLL1qfwhtZQUo/FEzDNTM02IhundzEJLG0ZGkGvdqc8Yu r6+7x1Wq3w3P79kOgtjFgVXAoRqM6VDfQXYYzf0ay269nIEf9RmpwJ6/wVxP9BzCGd9N 0s6w== X-Gm-Message-State: AOAM530iCg9JkJoz983laize3pR6+aDfjKqattctcSg6j1Ya4HmYrV4j JlgVd6G/r81P54rS59oC99T/6Q== X-Received: by 2002:a9d:718e:: with SMTP id o14mr15089096otj.299.1634422618854; Sat, 16 Oct 2021 15:16:58 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:58 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 4/7] drm/msm/dp: Allow attaching a drm_panel Date: Sat, 16 Oct 2021 15:18:40 -0700 Message-Id: <20211016221843.2167329-5-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" eDP panels might need some power sequencing and backlight management, so make it possible to associate a drm_panel with an eDP instance and prepare and enable the panel accordingly. Now that we know which hardware instance is DP and which is eDP, parser->parse() is passed the connector_type and the parser is limited to only search for a panel in the eDP case. Signed-off-by: Bjorn Andersson --- Changes since v4: - None drivers/gpu/drm/msm/dp/dp_display.c | 9 ++++++--- drivers/gpu/drm/msm/dp/dp_display.h | 1 + drivers/gpu/drm/msm/dp/dp_drm.c | 11 +++++++++++ drivers/gpu/drm/msm/dp/dp_parser.c | 30 ++++++++++++++++++++++++++++- drivers/gpu/drm/msm/dp/dp_parser.h | 3 ++- 5 files changed, 49 insertions(+), 5 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index 6913970c8cf9..c663cd619925 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -10,6 +10,7 @@ #include #include #include +#include #include "msm_drv.h" #include "msm_kms.h" @@ -230,12 +231,14 @@ static int dp_display_bind(struct device *dev, struct device *master, priv = drm->dev_private; priv->dp = &(dp->dp_display); - rc = dp->parser->parse(dp->parser); + rc = dp->parser->parse(dp->parser, dp->dp_display.connector_type); if (rc) { DRM_ERROR("device tree parsing failed\n"); goto end; } + dp->dp_display.panel_bridge = dp->parser->panel_bridge; + dp->aux->drm_dev = drm; rc = dp_aux_register(dp->aux); if (rc) { @@ -822,7 +825,7 @@ static int dp_display_set_mode(struct msm_dp *dp_display, return 0; } -static int dp_display_prepare(struct msm_dp *dp) +static int dp_display_prepare(struct msm_dp *dp_display) { return 0; } @@ -896,7 +899,7 @@ static int dp_display_disable(struct dp_display_private *dp, u32 data) return 0; } -static int dp_display_unprepare(struct msm_dp *dp) +static int dp_display_unprepare(struct msm_dp *dp_display) { return 0; } diff --git a/drivers/gpu/drm/msm/dp/dp_display.h b/drivers/gpu/drm/msm/dp/dp_display.h index 75fcabcfbbdd..8e80e3bac394 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.h +++ b/drivers/gpu/drm/msm/dp/dp_display.h @@ -15,6 +15,7 @@ struct msm_dp { struct device *codec_dev; struct drm_connector *connector; struct drm_encoder *encoder; + struct drm_bridge *panel_bridge; bool is_connected; bool audio_enabled; bool power_on; diff --git a/drivers/gpu/drm/msm/dp/dp_drm.c b/drivers/gpu/drm/msm/dp/dp_drm.c index f33e31523f56..76856c4ee1d6 100644 --- a/drivers/gpu/drm/msm/dp/dp_drm.c +++ b/drivers/gpu/drm/msm/dp/dp_drm.c @@ -5,6 +5,7 @@ #include #include +#include #include #include "msm_drv.h" @@ -160,5 +161,15 @@ struct drm_connector *dp_drm_connector_init(struct msm_dp *dp_display) drm_connector_attach_encoder(connector, dp_display->encoder); + if (dp_display->panel_bridge) { + ret = drm_bridge_attach(dp_display->encoder, + dp_display->panel_bridge, NULL, + DRM_BRIDGE_ATTACH_NO_CONNECTOR); + if (ret < 0) { + DRM_ERROR("failed to attach panel bridge: %d\n", ret); + return ERR_PTR(ret); + } + } + return connector; } diff --git a/drivers/gpu/drm/msm/dp/dp_parser.c b/drivers/gpu/drm/msm/dp/dp_parser.c index 4d6e047f803d..eb6bbfbea484 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.c +++ b/drivers/gpu/drm/msm/dp/dp_parser.c @@ -6,6 +6,7 @@ #include #include +#include #include #include "dp_parser.h" @@ -263,7 +264,28 @@ static int dp_parser_clock(struct dp_parser *parser) return 0; } -static int dp_parser_parse(struct dp_parser *parser) +static int dp_parser_find_panel(struct dp_parser *parser) +{ + struct device *dev = &parser->pdev->dev; + struct drm_panel *panel; + int rc; + + rc = drm_of_find_panel_or_bridge(dev->of_node, 1, 0, &panel, NULL); + if (rc) { + DRM_ERROR("failed to acquire DRM panel: %d\n", rc); + return rc; + } + + parser->panel_bridge = devm_drm_panel_bridge_add(dev, panel); + if (IS_ERR(parser->panel_bridge)) { + DRM_ERROR("failed to create panel bridge\n"); + return PTR_ERR(parser->panel_bridge); + } + + return 0; +} + +static int dp_parser_parse(struct dp_parser *parser, int connector_type) { int rc = 0; @@ -284,6 +306,12 @@ static int dp_parser_parse(struct dp_parser *parser) if (rc) return rc; + if (connector_type == DRM_MODE_CONNECTOR_eDP) { + rc = dp_parser_find_panel(parser); + if (rc) + return rc; + } + /* Map the corresponding regulator information according to * version. Currently, since we only have one supported platform, * mapping the regulator directly. diff --git a/drivers/gpu/drm/msm/dp/dp_parser.h b/drivers/gpu/drm/msm/dp/dp_parser.h index dac10923abde..3172da089421 100644 --- a/drivers/gpu/drm/msm/dp/dp_parser.h +++ b/drivers/gpu/drm/msm/dp/dp_parser.h @@ -123,8 +123,9 @@ struct dp_parser { struct dp_display_data disp_data; const struct dp_regulator_cfg *regulator_cfg; u32 max_dp_lanes; + struct drm_bridge *panel_bridge; - int (*parse)(struct dp_parser *parser); + int (*parse)(struct dp_parser *parser, int connector_type); }; /** From patchwork Sat Oct 16 22:18:41 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515904 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279640imp; Sat, 16 Oct 2021 15:17:24 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwwTU29OIyvuTTSgHbcOPa15vxbzd7suumBobRrs80l73iYzypoEfsnUv5Nfee8u6lcoyqj X-Received: by 2002:a17:902:e5c7:b0:13f:1dd9:1f25 with SMTP id u7-20020a170902e5c700b0013f1dd91f25mr18597033plf.35.1634422644594; Sat, 16 Oct 2021 15:17:24 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422644; cv=none; d=google.com; s=arc-20160816; b=lvT3IdnukA2aJCwSTg7c76xTXeoDsJ57tEN1SJFpo65ujXWX1JS7/nUzMT6pqd3eJS vlk5fpau+EURg4DC22Don3wu1wTdjGqI78EcgM0rFqV4yYefgPqtWxY8s2XMMJLgzEjb UMP1kF8l46fB8FF3rOkNo9IlnZpohT0Udzhr1GFJovEgNvVP45FsEFo0AIh8BPxmPJ0c lx5poi9jf/9OuIiw+ns8whrv3qOvGIDVCM4BdPiF0s/AFLDdXQuDJykefbXLUFkw3a0G 7bhH0YyU9CQ1LavKo6RjpJ7HT29NX5NhKxRZIS1Nt3G4/coGwIBei/Idge4+hLFZPucf 1jZw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=Oaf7oKCKNt5zDVv32IQLkUx20SUfAMQskiBhw89xugs=; b=s1slIzbcD3AfEo+U5dBU38xPrW5MlDxV24kSh4quieU8JVbMo8e1/u5XP4mFkPjbsC bIft40T/r92mMf3XjYXPPFJOoAZjP5qRRrhXn4WWg0jLO40KIVyugNackESeroNpzO+E c4yW0JL2Su/YXqLVGclh3J4aeQrkpExjP7jPfFba2DnyJOrq6+EBMQDDILdXY4zI2tbk Ql95gUFWxnIfnGeqCboHrgIfXRGQTN/o9lppmctKwTk25M0sOZL6a/q5JOTk9dXQ9ruz 25JlaOqqR+cMLBIUAOw8qyJs7zwA2PxpJVgMkI4tBZ5zseVysQlZNDFGAKbK2+d3bse6 y1zQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=opqM9NK8; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id p2si11029023plb.83.2021.10.16.15.17.24 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:24 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=opqM9NK8; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 598966E8F7; Sat, 16 Oct 2021 22:17:06 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oi1-x22d.google.com (mail-oi1-x22d.google.com [IPv6:2607:f8b0:4864:20::22d]) by gabe.freedesktop.org (Postfix) with ESMTPS id 88B966E8F0 for ; Sat, 16 Oct 2021 22:17:00 +0000 (UTC) Received: by mail-oi1-x22d.google.com with SMTP id v77so14389843oie.1 for ; Sat, 16 Oct 2021 15:17:00 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=Oaf7oKCKNt5zDVv32IQLkUx20SUfAMQskiBhw89xugs=; b=opqM9NK8EKbAMPW1hJ7g6jbkqyGoc5A7J0aM47gJC4d1X0T0LbSEXlZFOKJaV59MBz bDE9MJb2dSEZVJloT13ZYPe021OFIHRUINyP//VQmB4YbsqRsPWmCa+zLTM871Gvhb/Y TfYs9ok9AW2ndvrLgyz8mzm8fkLiKdIkXH/4SFlyZATd7Zs0ZhIsWW/IWptdvu9IKb/f 8tubnjUtQe/gllbHcCJE4b9Y6/38h1Y5I3JiGas1YofcUzs1w/eDdeRXglLgk2j4iNI+ fRh+mFF6450YkV3+Ea3grBt2YVfzDX9GTXeOERlah5bKPlCJjI8jbnX7V/fgaKZIbdCq hjqg== 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=Oaf7oKCKNt5zDVv32IQLkUx20SUfAMQskiBhw89xugs=; b=H0Z/vRvxKmR1RdbeBIz5g6GgcZVbgG1ZQpg8BHS5AsEKVLZWdrB2BvmmOocK9BWt/X p6IpSvPN61ofeWds1Y9ATiyv1nqqQRPhsaC8CtTzi4DoUWVxlhEw8ZGOVC2Vy3/wfs9z InMMWs5Un+fUiPSLTgBZmzgsycC5ZO9NWH5PItjMCHdmszUUIG+ykxuQEjDgp2Cnratm JYVUIS7D2m0WeYT3r/hDr1nhWt3T2cWAoRCazGVBfN/rIJ0lxuqwEKRtdXVNb3/V9D/4 dWzf7PCeuaXS6JChcF5uU6GEl6vgbmIWzO00sweADK7SHfGzit1uiYXJrQPNwVCSOFLV ETKg== X-Gm-Message-State: AOAM533H2GRxj6wIssWVVS3/47+J1DrpixE2HalNakmC6zR7mo540Jpm eNHTL+73vxjC0rOPpaMPuUiaJg== X-Received: by 2002:a05:6808:1248:: with SMTP id o8mr22991355oiv.151.1634422619825; Sat, 16 Oct 2021 15:16:59 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:16:59 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 5/7] drm/msm/dp: Support up to 3 DP controllers Date: Sat, 16 Oct 2021 15:18:41 -0700 Message-Id: <20211016221843.2167329-6-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" Based on the removal of the g_dp_display and the movement of the priv->dp lookup into the DP code it's now possible to have multiple DP instances. In line with the other controllers in the MSM driver, introduce a per-compatible list of base addresses which is used to resolve the "instance id" for the given DP controller. This instance id is used as index in the priv->dp[] array. Then extend the initialization code to initialize struct drm_encoder for each of the registered priv->dp[] and update the logic for associating each struct msm_dp with the struct dpu_encoder_virt. A new enum is introduced to document the connection between the instances referenced in the dpu_intf_cfg array and the controllers in the DP driver and sc7180 is updated. Lastly, bump the number of struct msm_dp instances carries by priv->dp to 3, the currently known maximum number of controllers found in a Qualcomm SoC. Signed-off-by: Bjorn Andersson --- Changes since v4: - MSM_DP_CONTROLLER_n introduced to clarify the relationship between the intf specification and the indices of the msm_dp_desc - Unnecessary parenthesis around dp->dp_display was dropped drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 2 +- .../gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 2 +- drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c | 66 +++++++++++-------- .../gpu/drm/msm/disp/msm_disp_snapshot_util.c | 8 ++- drivers/gpu/drm/msm/dp/dp_display.c | 20 ++++-- drivers/gpu/drm/msm/msm_drv.h | 9 ++- 6 files changed, 68 insertions(+), 39 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c index b7f33da2799c..9cd9539a1504 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c @@ -2173,7 +2173,7 @@ int dpu_encoder_setup(struct drm_device *dev, struct drm_encoder *enc, dpu_encoder_vsync_event_handler, 0); else if (disp_info->intf_type == DRM_MODE_ENCODER_TMDS) - dpu_enc->dp = priv->dp; + dpu_enc->dp = priv->dp[disp_info->h_tile_instance[0]]; INIT_DELAYED_WORK(&dpu_enc->delayed_off_work, dpu_encoder_off_work); diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index 60eed3128b54..47d5d71eb5d3 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -900,7 +900,7 @@ static const struct dpu_intf_cfg sdm845_intf[] = { }; static const struct dpu_intf_cfg sc7180_intf[] = { - INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25), + INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, MSM_DP_CONTROLLER_0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 24, 25), INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC7180_MASK, MDP_SSPP_TOP0_INTR, 26, 27), }; diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c index f655adbc2421..875b07e7183d 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_kms.c @@ -188,6 +188,7 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) struct dentry *entry; struct drm_device *dev; struct msm_drm_private *priv; + int i; if (!p) return -EINVAL; @@ -203,8 +204,10 @@ static int dpu_kms_debugfs_init(struct msm_kms *kms, struct drm_minor *minor) dpu_debugfs_vbif_init(dpu_kms, entry); dpu_debugfs_core_irq_init(dpu_kms, entry); - if (priv->dp) - msm_dp_debugfs_init(priv->dp, minor); + for (i = 0; i < ARRAY_SIZE(priv->dp); i++) { + if (priv->dp[i]) + msm_dp_debugfs_init(priv->dp[i], minor); + } return dpu_core_perf_debugfs_init(dpu_kms, entry); } @@ -544,35 +547,42 @@ static int _dpu_kms_initialize_displayport(struct drm_device *dev, { struct drm_encoder *encoder = NULL; struct msm_display_info info; - int rc = 0; + int rc; + int i; - if (!priv->dp) - return rc; + for (i = 0; i < ARRAY_SIZE(priv->dp); i++) { + if (!priv->dp[i]) + continue; - encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); - if (IS_ERR(encoder)) { - DPU_ERROR("encoder init failed for dsi display\n"); - return PTR_ERR(encoder); - } + encoder = dpu_encoder_init(dev, DRM_MODE_ENCODER_TMDS); + if (IS_ERR(encoder)) { + DPU_ERROR("encoder init failed for dsi display\n"); + return PTR_ERR(encoder); + } - memset(&info, 0, sizeof(info)); - rc = msm_dp_modeset_init(priv->dp, dev, encoder); - if (rc) { - DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); - drm_encoder_cleanup(encoder); - return rc; - } + memset(&info, 0, sizeof(info)); + rc = msm_dp_modeset_init(priv->dp[i], dev, encoder); + if (rc) { + DPU_ERROR("modeset_init failed for DP, rc = %d\n", rc); + drm_encoder_cleanup(encoder); + return rc; + } - priv->encoders[priv->num_encoders++] = encoder; + priv->encoders[priv->num_encoders++] = encoder; - info.num_of_h_tiles = 1; - info.capabilities = MSM_DISPLAY_CAP_VID_MODE; - info.intf_type = encoder->encoder_type; - rc = dpu_encoder_setup(dev, encoder, &info); - if (rc) - DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", - encoder->base.id, rc); - return rc; + info.num_of_h_tiles = 1; + info.h_tile_instance[0] = i; + info.capabilities = MSM_DISPLAY_CAP_VID_MODE; + info.intf_type = encoder->encoder_type; + rc = dpu_encoder_setup(dev, encoder, &info); + if (rc) { + DPU_ERROR("failed to setup DPU encoder %d: rc:%d\n", + encoder->base.id, rc); + return rc; + } + } + + return 0; } /** @@ -792,6 +802,7 @@ static int dpu_irq_postinstall(struct msm_kms *kms) { struct msm_drm_private *priv; struct dpu_kms *dpu_kms = to_dpu_kms(kms); + int i; if (!dpu_kms || !dpu_kms->dev) return -EINVAL; @@ -800,7 +811,8 @@ static int dpu_irq_postinstall(struct msm_kms *kms) if (!priv) return -EINVAL; - msm_dp_irq_postinstall(priv->dp); + for (i = 0; i < ARRAY_SIZE(priv->dp); i++) + msm_dp_irq_postinstall(priv->dp[i]); return 0; } diff --git a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c index cabe15190ec1..2e1acb1bc390 100644 --- a/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c +++ b/drivers/gpu/drm/msm/disp/msm_disp_snapshot_util.c @@ -126,8 +126,12 @@ void msm_disp_snapshot_capture_state(struct msm_disp_state *disp_state) priv = drm_dev->dev_private; kms = priv->kms; - if (priv->dp) - msm_dp_snapshot(disp_state, priv->dp); + for (i = 0; i < ARRAY_SIZE(priv->dp); i++) { + if (!priv->dp[i]) + continue; + + msm_dp_snapshot(disp_state, priv->dp[i]); + } for (i = 0; i < ARRAY_SIZE(priv->dsi); i++) { if (!priv->dsi[i]) diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index c663cd619925..d3c9d7273354 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -79,6 +79,8 @@ struct dp_display_private { char *name; int irq; + unsigned int id; + /* state variables */ bool core_initialized; bool hpd_irq_on; @@ -128,7 +130,7 @@ struct msm_dp_config { static const struct msm_dp_config sc7180_dp_cfg = { .descs = (const struct msm_dp_desc[]) { - { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, + [MSM_DP_CONTROLLER_0] = { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, }, .num_descs = 1, }; @@ -229,7 +231,7 @@ static int dp_display_bind(struct device *dev, struct device *master, dp->dp_display.drm_dev = drm; priv = drm->dev_private; - priv->dp = &(dp->dp_display); + priv->dp[dp->id] = &dp->dp_display; rc = dp->parser->parse(dp->parser, dp->dp_display.connector_type); if (rc) { @@ -269,7 +271,7 @@ static void dp_display_unbind(struct device *dev, struct device *master, dp_power_client_deinit(dp->power); dp_aux_unregister(dp->aux); - priv->dp = NULL; + priv->dp[dp->id] = NULL; } static const struct component_ops dp_display_comp_ops = { @@ -1200,7 +1202,8 @@ int dp_display_request_irq(struct msm_dp *dp_display) return 0; } -static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev) +static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pdev, + unsigned int *id) { const struct msm_dp_config *cfg = of_device_get_match_data(&pdev->dev); struct resource *res; @@ -1210,9 +1213,12 @@ static const struct msm_dp_desc *dp_display_get_desc(struct platform_device *pde if (!res) return NULL; - for (i = 0; i < cfg->num_descs; i++) - if (cfg->descs[i].io_start == res->start) + for (i = 0; i < cfg->num_descs; i++) { + if (cfg->descs[i].io_start == res->start) { + *id = i; return &cfg->descs[i]; + } + } dev_err(&pdev->dev, "unknown displayport instance\n"); return NULL; @@ -1233,7 +1239,7 @@ static int dp_display_probe(struct platform_device *pdev) if (!dp) return -ENOMEM; - desc = dp_display_get_desc(pdev); + desc = dp_display_get_desc(pdev, &dp->id); if (!desc) return -EINVAL; diff --git a/drivers/gpu/drm/msm/msm_drv.h b/drivers/gpu/drm/msm/msm_drv.h index 8b005d1ac899..bfd5022a9e6d 100644 --- a/drivers/gpu/drm/msm/msm_drv.h +++ b/drivers/gpu/drm/msm/msm_drv.h @@ -68,6 +68,13 @@ enum msm_mdp_plane_property { PLANE_PROP_MAX_NUM }; +enum msm_dp_controller { + MSM_DP_CONTROLLER_0, + MSM_DP_CONTROLLER_1, + MSM_DP_CONTROLLER_2, + MSM_DP_CONTROLLER_COUNT, +}; + #define MSM_GPU_MAX_RINGS 4 #define MAX_H_TILES_PER_DISPLAY 2 @@ -161,7 +168,7 @@ struct msm_drm_private { /* DSI is shared by mdp4 and mdp5 */ struct msm_dsi *dsi[2]; - struct msm_dp *dp; + struct msm_dp *dp[MSM_DP_CONTROLLER_COUNT]; /* when we have more than one 'msm_gpu' these need to be an array: */ struct msm_gpu *gpu; From patchwork Sat Oct 16 22:18:42 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515906 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279690imp; Sat, 16 Oct 2021 15:17:30 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyhDcYnAnTwmRHjMo8bj3dQgYnTQMH9Yiq3HHiZpL2bxFRcgJ/rzbrrgM+qWQgqiKPlsQPW X-Received: by 2002:a65:5385:: with SMTP id x5mr15786395pgq.140.1634422649886; Sat, 16 Oct 2021 15:17:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422649; cv=none; d=google.com; s=arc-20160816; b=CNNbPTnFBIY2J8rpoasdMyjSjYs722TsV2JQJ0SMe54FWRcDYNhxspu2kdh/hIynzz blXS2Of7gFm3BD9YsIvUmBUmdAi6Bi3GqciWwq/FqfqneskwMOujGY40exH+RPFKIUs5 euqzl7y+k7kGkk9gwbynBEGsNL4IVX2Zeas1MP1vbKeg6AoIjIlW3muS/lnN/3FJhQw7 Zo9hNFurR1Id0ytlkp9KrksK4IoyHZ/c7RUyShjv3MYj4cVN+htFodz6yaN669FTH5jd mEmLBQINVz/6IAwxJ9yR+wy8M8JNW8gfLyh+nga5skHXzBU7V+hDIrpNr+7koKLNWf7H g8/g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=YCldvVc/GAW/slmnXCOBbon0kUi8IujN99j0wGc0Qok=; b=ZGHQBEHZwLmHB70PLHxi+o8oGW0zEHofE0cSb43SWo970VV3b/CoswpVxa1mm3Hd50 rSRKIbp3LlUumkg1GKyqucsTf9W+YoG7R9NIq+WQt0xbpqUCjtwjthPBDxcrViaOWs+G N4R3zSefQrsqPFNcojODias15/KrRRIHeh7EyY4bsvg3ky7Lwlf+izsNyYEubNJPNvB8 9Pa81SM2bv9IgmA3Wno8MnPIkdiYQwNA7hCSh7er8QPW1thF9xkvZH5f1lh0DFtyCMt/ Maoh63tXn0YaZmW29n+NvQFmaWf2SQjhby+JK1Q/2MoENmdohucYqQsDGp/Ty3rmHI7Z Rngw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IczW/rI+"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [131.252.210.177]) by mx.google.com with ESMTPS id ij23si7029658plb.7.2021.10.16.15.17.29 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:29 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) client-ip=131.252.210.177; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="IczW/rI+"; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 131.252.210.177 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id CB6E86E8FF; Sat, 16 Oct 2021 22:17:09 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-oo1-xc30.google.com (mail-oo1-xc30.google.com [IPv6:2607:f8b0:4864:20::c30]) by gabe.freedesktop.org (Postfix) with ESMTPS id 685296E8F2 for ; Sat, 16 Oct 2021 22:17:01 +0000 (UTC) Received: by mail-oo1-xc30.google.com with SMTP id k11-20020a4aa5cb000000b002b73749f3cdso823871oom.4 for ; Sat, 16 Oct 2021 15:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=YCldvVc/GAW/slmnXCOBbon0kUi8IujN99j0wGc0Qok=; b=IczW/rI+KCJMj4UJ0xuZXt8fK4/dUd6jCLECu9YvS8izjoIBu2E54TmymUBMFMW3vi WcAoFcM/ewacm0E9evClgmk52nGAOX/t8HljhwY4Yuucfp6tXg9KFWeFbWWddo/y4F8K nd5uKet4+hVNTszkYWEfis2J1c24NdiI3TzK5kC+p+JMgJdGxrLALklYowjCFj1rrQmi VEm3J1/eEUbiaanf5OCaNRrMidNBBgYh6L+8rszeegK1B3ebutu9+F/vFFJun2A+ODoz zZF8UMA/jMHSTpnwHgR9Ys6t600eHl2jutiziHBDHwhz5gl+6HDGMJZqPRyIXSjsruN4 Z35A== 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=YCldvVc/GAW/slmnXCOBbon0kUi8IujN99j0wGc0Qok=; b=HMY0ksCd3OEcaeZ1nNAZWKY/NIf56TLrqETmHksCr8aJu2oF27Eo2PgsN+GKTPR3XH LDSopOMY3a7q1VhLqt8HJ+QSAzzSIKVMMb6dg5wWGS6U1jmyieba/uGuF4qdR9OazRIs PTVVQmIKTV1rqFhFwh+J5vdVZrSoKDR26TMlyBXyFlDad7oPOXQfm0CoEsAIOUXG5TUU b5ChIYYO3GTme+hfS+n80EGexFglLCvtBwNnSpqkyRMBIegPGZWP9Y+HfjGs0y1zP+2T aDtX5gSsIEKhH2oniJr6ghmdDuqYBeCGce8hSJ/LL4rnoAr8cuFy4kNvANOsd9dB4xd1 PYCA== X-Gm-Message-State: AOAM530RAxvhIyad2rSza3TOxYwchiZudfpORK/0mWi6yMq8L/pPh6kA nHNqwBeXenepHje9oODNEl15dg== X-Received: by 2002:a4a:a847:: with SMTP id p7mr11089393oom.78.1634422620720; Sat, 16 Oct 2021 15:17:00 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.16.59 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:00 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 6/7] dt-bindings: msm/dp: Add SC8180x compatibles Date: Sat, 16 Oct 2021 15:18:42 -0700 Message-Id: <20211016221843.2167329-7-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The Qualcomm SC8180x has 2 DP controllers and 1 eDP controller, add compatibles for these to the msm/dp binding. Reviewed-by: Abhinav Kumar Reviewed-by: Stephen Boyd Signed-off-by: Bjorn Andersson --- Changes since v4: - None .../devicetree/bindings/display/msm/dp-controller.yaml | 2 ++ 1 file changed, 2 insertions(+) -- 2.29.2 diff --git a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml index 6bb424c21340..63e585f48789 100644 --- a/Documentation/devicetree/bindings/display/msm/dp-controller.yaml +++ b/Documentation/devicetree/bindings/display/msm/dp-controller.yaml @@ -17,6 +17,8 @@ properties: compatible: enum: - qcom,sc7180-dp + - qcom,sc8180x-dp + - qcom,sc8180x-edp reg: items: From patchwork Sat Oct 16 22:18:43 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 515903 Delivered-To: patch@linaro.org Received: by 2002:ac0:cd8c:0:0:0:0:0 with SMTP id d12csp279611imp; Sat, 16 Oct 2021 15:17:22 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyRbX35KruFSzLuzkj+85lJBVUSuWY+x44EpDf5a/n2zU7Apnp0yi9+HAzupvWqrkLVajuL X-Received: by 2002:a17:90a:ad46:: with SMTP id w6mr36678795pjv.68.1634422641865; Sat, 16 Oct 2021 15:17:21 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634422641; cv=none; d=google.com; s=arc-20160816; b=fDLWxo2eue+XyUVdb86n3GrhFKy0iRGWLUWkIbDtzH8oPx3hnmKqVtv3xP5ob0bnTM Hg85a30n4FNywh0AtlH8wT3+hHo/7BLEGi9uGD++6OT+n1s0ikO/m+nQYL1b5MQNeTBT r07dfKmjtG/jeYpkKM8uAncHcYV5jHFw5uj88T72AxcbBg8Qgla+r6SAg+kurH2+NQkk DuwFZo26ZmX32bVxLlMmGpiJqBd6xrsYwyVmuoL/v8R1svsAUtyY5zhJQGe8KxcKjXXH qeQes/dWm0MrN/nixn1Bcj5FAYziO5GrUwmEiFylsdWhSm/Crz4ND1Pdm2iGoJK6mInh PfiA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature:delivered-to; bh=f3Y7Ha8qdHXB57ScuBGUf5G032rtC1aky5TYdKeHYlc=; b=Gl8ivLJYO6u4n9SkKeVzr7mAYdhfrZCN2FmiY46Ph7/FwWVctrNH7Kv0BD8IQqgcZW NBBekylI1lBX7hgSvM8PF3EULJNxlVW7KJeR/xPze2T5AGto/vxU/hwdJrFWNhdj1NFc 6v5lEz42VGK+g0Uym+Rj5+KFQPU4dicQfEFoPEDUqwbFOHGRT8LiN3pknveI+YT4Bzdj AAqKrIFS6tZjMKQm4IzeKUELVjtRUvVJGBfxwy33YVNBxu+BVQNAfzYKycBxrTOKZ5TG N5/Q57ZA3NeSVWUG1QPGfpD+Qc19CS2mH9ypallKS5UHZ08z2kAy2E7WRgLf/rM7+xbV N3dg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SMPbkoRB; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from gabe.freedesktop.org (gabe.freedesktop.org. [2610:10:20:722:a800:ff:fe36:1795]) by mx.google.com with ESMTPS id u1si13946527plh.344.2021.10.16.15.17.21 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:21 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) client-ip=2610:10:20:722:a800:ff:fe36:1795; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=SMPbkoRB; spf=pass (google.com: best guess record for domain of dri-devel-bounces@lists.freedesktop.org designates 2610:10:20:722:a800:ff:fe36:1795 as permitted sender) smtp.mailfrom=dri-devel-bounces@lists.freedesktop.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6FA236E8F0; Sat, 16 Oct 2021 22:17:05 +0000 (UTC) X-Original-To: dri-devel@lists.freedesktop.org Delivered-To: dri-devel@lists.freedesktop.org Received: from mail-ot1-x333.google.com (mail-ot1-x333.google.com [IPv6:2607:f8b0:4864:20::333]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6003D6E8F6 for ; Sat, 16 Oct 2021 22:17:02 +0000 (UTC) Received: by mail-ot1-x333.google.com with SMTP id v2-20020a05683018c200b0054e3acddd91so305803ote.8 for ; Sat, 16 Oct 2021 15:17:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=f3Y7Ha8qdHXB57ScuBGUf5G032rtC1aky5TYdKeHYlc=; b=SMPbkoRBB/lcOrzbs9uZ+F6Va/xvb4NkR7QxSekAe6cWEZj23J6RoSS072CbhPFDxP 9CNlSwRIyMQi/vCboyvGcqBGiC3bBwNUsau1uVcOYQODu1okGWl+pWWYUXDPJtR367St LfZFCS6zMV+JAtOdlsVr9sWK4ePwJuC6nSW+reiwChzB7qQvx+KTC32b51nG7qqpFSG2 19S5HtRqL9qAa0AYpXlHHAe8fggbFMimJWUSt2gMi8tgOd73+qv3q33/wcYAUCBmk5+7 tfy3NMASW2VeveqXztb3/eM5CkThQBn0jP4PJbY6IkRpe7zNfNdJIrFYyW9qaJI8vuQU whqQ== 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=f3Y7Ha8qdHXB57ScuBGUf5G032rtC1aky5TYdKeHYlc=; b=wiW/OpcGY7K8TIwNR6aDBKKUzzzoHx8S7qDPhxUu4q920hp7RCLOx42ugRlrXg46fX ahN8yDdPeE3Awg15PIL+lpE3Zbb17ro4pa30ptspv6rX/nC0ki0VJSYUg5JM7XPjFcl5 PIEkmVnUWiXG9SDrrfjzkRZ14BKnhgEXyNSXCTaEi/uxYHP4timPk9pLt6AijndiLeAI NeM33g618lye7NCOqYCT8kVgue1yoSsyBCS71MYAbRdJ6UzgzAbCcF4boAiIe5pPap/j H5f5yw6xL7ew0LFTlc9+DnFiWsvpCkjY8Yz6+ZFs0htTrb+ZL3AKvTOEiAJPR2w9Vkdp D1Jg== X-Gm-Message-State: AOAM5332iDxqo8cxr9qBx1Pp0PJyn9VWBoBcJHMjFq+YRMFPt5T4QAg8 UfXEHcs2RdQPGSgefDgCzqqXQA== X-Received: by 2002:a9d:70c4:: with SMTP id w4mr2703584otj.170.1634422621620; Sat, 16 Oct 2021 15:17:01 -0700 (PDT) Received: from localhost.localdomain ([2600:1700:a0:3dc8:205:1bff:fec0:b9b3]) by smtp.gmail.com with ESMTPSA id d15sm1747058oic.32.2021.10.16.15.17.00 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sat, 16 Oct 2021 15:17:01 -0700 (PDT) From: Bjorn Andersson To: Rob Clark , Sean Paul , David Airlie , Daniel Vetter , Abhinav Kumar , Dmitry Baryshkov , Kalyan Thota , Kuogee Hsieh Cc: Rob Herring , Stephen Boyd , linux-arm-msm@vger.kernel.org, dri-devel@lists.freedesktop.org, freedreno@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH v5 7/7] drm/msm/dp: Add sc8180x DP controllers Date: Sat, 16 Oct 2021 15:18:43 -0700 Message-Id: <20211016221843.2167329-8-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20211016221843.2167329-1-bjorn.andersson@linaro.org> References: <20211016221843.2167329-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 X-BeenThere: dri-devel@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Direct Rendering Infrastructure - Development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: dri-devel-bounces@lists.freedesktop.org Sender: "dri-devel" The sc8180x has 2 DP and 1 eDP controllers, add support for these to the DP driver. Link: https://lore.kernel.org/linux-arm-msm/20210725042436.3967173-7-bjorn.andersson@linaro.org/ Signed-off-by: Bjorn Andersson --- Changes since v4: - Use the MSM_DP_CONTROLLER_n enums - const the msm_dp_desc array drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c | 6 +++--- drivers/gpu/drm/msm/dp/dp_display.c | 11 +++++++++++ 2 files changed, 14 insertions(+), 3 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd Reviewed-by: Abhinav Kumar diff --git a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c index 47d5d71eb5d3..0ac6a79e8af9 100644 --- a/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c +++ b/drivers/gpu/drm/msm/disp/dpu1/dpu_hw_catalog.c @@ -918,13 +918,13 @@ static const struct dpu_intf_cfg sc7280_intf[] = { }; static const struct dpu_intf_cfg sc8180x_intf[] = { - INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, 0, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 24, 25), + INTF_BLK("intf_0", INTF_0, 0x6A000, INTF_DP, MSM_DP_CONTROLLER_0, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 24, 25), INTF_BLK("intf_1", INTF_1, 0x6A800, INTF_DSI, 0, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 26, 27), INTF_BLK("intf_2", INTF_2, 0x6B000, INTF_DSI, 1, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 28, 29), /* INTF_3 is for MST, wired to INTF_DP 0 and 1, use dummy index until this is supported */ INTF_BLK("intf_3", INTF_3, 0x6B800, INTF_DP, 999, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 30, 31), - INTF_BLK("intf_4", INTF_4, 0x6C000, INTF_DP, 1, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 20, 21), - INTF_BLK("intf_5", INTF_5, 0x6C800, INTF_DP, 2, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 22, 23), + INTF_BLK("intf_4", INTF_4, 0x6C000, INTF_DP, MSM_DP_CONTROLLER_1, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 20, 21), + INTF_BLK("intf_5", INTF_5, 0x6C800, INTF_DP, MSM_DP_CONTROLLER_2, 24, INTF_SC8180X_MASK, MDP_SSPP_TOP0_INTR, 22, 23), }; /************************************************************* diff --git a/drivers/gpu/drm/msm/dp/dp_display.c b/drivers/gpu/drm/msm/dp/dp_display.c index d3c9d7273354..70dcd4e6d466 100644 --- a/drivers/gpu/drm/msm/dp/dp_display.c +++ b/drivers/gpu/drm/msm/dp/dp_display.c @@ -135,8 +135,19 @@ static const struct msm_dp_config sc7180_dp_cfg = { .num_descs = 1, }; +static const struct msm_dp_config sc8180x_dp_cfg = { + .descs = (const struct msm_dp_desc[]) { + [MSM_DP_CONTROLLER_0] = { .io_start = 0x0ae90000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, + [MSM_DP_CONTROLLER_1] = { .io_start = 0x0ae98000, .connector_type = DRM_MODE_CONNECTOR_DisplayPort }, + [MSM_DP_CONTROLLER_2] = { .io_start = 0x0ae9a000, .connector_type = DRM_MODE_CONNECTOR_eDP }, + }, + .num_descs = 3, +}; + static const struct of_device_id dp_dt_match[] = { { .compatible = "qcom,sc7180-dp", .data = &sc7180_dp_cfg }, + { .compatible = "qcom,sc8180x-dp", .data = &sc8180x_dp_cfg }, + { .compatible = "qcom,sc8180x-edp", .data = &sc8180x_dp_cfg }, {} };