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);