From patchwork Wed Aug 25 23:42:30 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Bjorn Andersson X-Patchwork-Id: 502324 Delivered-To: patch@linaro.org Received: by 2002:a17:906:f0cd:0:0:0:0 with SMTP id dk13csp721593ejb; Wed, 25 Aug 2021 16:41:29 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyHCGBjd2OrqFOkA/RyQvGSDC2+Nn0TW8Wv8ZJV2gE4cOBfFNeFFs4/+PW2W0DAL5vMFrWA X-Received: by 2002:a05:6638:1905:: with SMTP id p5mr865356jal.25.1629934889350; Wed, 25 Aug 2021 16:41:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1629934889; cv=none; d=google.com; s=arc-20160816; b=Bto9EmqqH3Rn1D7BwdVZ0nLgYGUuQYzZtRK/mR1CIK29DO15lFzhzg5Wf/HSFhI1YL 7siP3uPEfGFQ4dY1FToTn1rgfuWksuLvtTkQc88HVLtGDZRqvx/E/68AZZUOfpN1lUrL uqbDTKAgIDziBXAM07ZiDEDXqy7TLy3Lfd7rW+G8IEKgkZwd/LvU6XvO6xI2/ObI2GWX Pn8YpmWUndjqah4ShLVOObDcATrXSIg0r7A0ybUZ3RlMvoDlizM4CsdIh3xL8tTvFVtf /IHYXXQ9rEaDZy/Dpbn6lMhnIk+6P6z3JmbYoJbv517GlKmNh7FuOmRVxQvON5Q6G8Ft EoDw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=/SUT6/CPQy4VuzfV2PpQSsF1DEYegx2l+83mHNGP6WQ=; b=ilJwGD8yKAVwMjgqpFntYRsjIr5/HlEmNFg39O3tPOnQx83EAWrWw2EP2PISylrXsF ejp+/3OA0gAKlEG6rKsqm0Ehg2xVjXZ+1g2LOUwdz2GoSp3Srz+yJ1z2216g/eK0OiAR xu77SMDDY4o1yRGeU+WM04h4FvGo067GoUJ/93ZjzQ+4HaSURPXGfkgew0jLhuJDonxw El/dnC+AwDNZ9wfn+YqsW/1e2ve8qQXwTBjCS3dDZ9h7nusjkV0dtMmQcxkpJvCwxLHp YD0CedBCOX0PN6Lj1LBz0VOmwdhVH50NIozZ+D9MP4AiwhA5htpHPy6+R8glYQqdkrLL dJQA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aBNo6IWt; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id l6si1082234ios.26.2021.08.25.16.41.29; Wed, 25 Aug 2021 16:41:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=aBNo6IWt; spf=pass (google.com: domain of linux-arm-msm-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-arm-msm-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234101AbhHYXmM (ORCPT + 16 others); Wed, 25 Aug 2021 19:42:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55232 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233730AbhHYXmK (ORCPT ); Wed, 25 Aug 2021 19:42:10 -0400 Received: from mail-oi1-x22c.google.com (mail-oi1-x22c.google.com [IPv6:2607:f8b0:4864:20::22c]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 7F5CBC0613C1 for ; Wed, 25 Aug 2021 16:41:23 -0700 (PDT) Received: by mail-oi1-x22c.google.com with SMTP id p2so2112196oif.1 for ; Wed, 25 Aug 2021 16:41:23 -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=/SUT6/CPQy4VuzfV2PpQSsF1DEYegx2l+83mHNGP6WQ=; b=aBNo6IWtJzImXbC1euEfhI81ak1ju0dMOsBX7Z7MsXlS1oGV7yhvpcNp/7KrArcVkI FjClKe19BQvluGfgAg+7Jt0gX2jzTDxOuwAIhSNkPP6cpxmv33Z9t0H9XnCTAkjWoZAz OeYtUxQ/WWxXaHt7OF8RkHWv6vAsYToBWjn+wXgLglFm5apCOE0nLoROvK26p2gcHj5l jZDMH107p5YMVNFyHTVdr76B5/QbIpq/PhVCcBQMgzLVOFN311NDYDvR9Es1i96HZjM5 NkyRS2N1tSego9wrDW7VFt4gx6N38aoSSMV8AethWs2UdKENGqCR2hCyxQ8JvGLASJJ1 qPNQ== 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=/SUT6/CPQy4VuzfV2PpQSsF1DEYegx2l+83mHNGP6WQ=; b=BiJs3PqDQyGNbo33mZLI4oY1pUoBJ2zCzKYLS4L1YCVvBQ4zoeyhINOluaOBKCnjfc yPGzefgOT0jJulgWfzUloXPxamQ+zO14Pg/Qx+p6GMPhLGR9cfXPNUg+bLnIXG7bEKUN WQlUe2gAmTXi0QZYBi7PtBKcqbcXmYwfCx+YZgdCRfRlMrVdByVKOnJnuyYkRVMh7ix0 mV3Tcx5mCez57oQrveak97y2cVqSxzvTvYohwmIsUtyTyVO3TdkMnD6FUTsUO/KS/y2f 6YtyvcgRD8G01Uw3n6WUktWZQQ3l5br+wdip+u1YLWzW7jUTN4XMt8gBrtx14yeqvSYm nsfw== X-Gm-Message-State: AOAM531nBPuJ5hiUdJ/EKrM9Al2vNiYvAY4h5X/h8wutYfobQyH68cGc SLjJ92mefBzSbIXxSRbEgsMSFg== X-Received: by 2002:a05:6808:1d3:: with SMTP id x19mr365072oic.137.1629934882911; Wed, 25 Aug 2021 16:41:22 -0700 (PDT) Received: from localhost.localdomain (104-57-184-186.lightspeed.austtx.sbcglobal.net. [104.57.184.186]) by smtp.gmail.com with ESMTPSA id g10sm267136oof.37.2021.08.25.16.41.22 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 25 Aug 2021 16:41:22 -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 v2 2/5] drm/msm/dp: Modify prototype of encoder based API Date: Wed, 25 Aug 2021 16:42:30 -0700 Message-Id: <20210825234233.1721068-3-bjorn.andersson@linaro.org> X-Mailer: git-send-email 2.29.2 In-Reply-To: <20210825234233.1721068-1-bjorn.andersson@linaro.org> References: <20210825234233.1721068-1-bjorn.andersson@linaro.org> MIME-Version: 1.0 Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@vger.kernel.org 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. Signed-off-by: Bjorn Andersson --- Changes since v1: - Store msm_dp reference in dpu_encoder_virt instead of carrying a list of them and searching repeatedly drivers/gpu/drm/msm/disp/dpu1/dpu_encoder.c | 23 ++++++++++++--------- 1 file changed, 13 insertions(+), 10 deletions(-) -- 2.29.2 Reviewed-by: Stephen Boyd 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);