From patchwork Tue Jan 10 10:17:51 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1723908 Return-Path: X-Original-To: incoming@patchwork.ozlabs.org Delivered-To: patchwork-incoming@legolas.ozlabs.org Authentication-Results: legolas.ozlabs.org; spf=pass (sender SPF authorized) smtp.mailfrom=lists.ubuntu.com (client-ip=91.189.94.19; helo=huckleberry.canonical.com; envelope-from=kernel-team-bounces@lists.ubuntu.com; receiver=) Authentication-Results: legolas.ozlabs.org; dkim=fail reason="signature verification failed" (2048-bit key; unprotected) header.d=gmail.com header.i=@gmail.com header.a=rsa-sha256 header.s=20210112 header.b=VQYsUg0I; dkim-atps=neutral Received: from huckleberry.canonical.com (huckleberry.canonical.com [91.189.94.19]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by legolas.ozlabs.org (Postfix) with ESMTPS id 4NrmxN0GYxz23g8 for ; Tue, 10 Jan 2023 21:18:48 +1100 (AEDT) Received: from localhost ([127.0.0.1] helo=huckleberry.canonical.com) by huckleberry.canonical.com with esmtp (Exim 4.86_2) (envelope-from ) id 1pFBiN-0005TR-4Z; Tue, 10 Jan 2023 10:18:43 +0000 Received: from mail-pj1-f50.google.com ([209.85.216.50]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1pFBiK-0005LL-T7 for kernel-team@lists.ubuntu.com; Tue, 10 Jan 2023 10:18:41 +0000 Received: by mail-pj1-f50.google.com with SMTP id n12so11854730pjp.1 for ; Tue, 10 Jan 2023 02:18:40 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:from:to:cc:subject:date :message-id:reply-to; bh=1FcZyRQeOQ9/ocTYIJrm9hAsEhwnL7JTetk+CZq3ENQ=; b=VQYsUg0IJtIzC+3N4pWTHqHbrrffiyw5I7csqKsDR9r4vqi77+UGZZwobWxfMbMVEJ d4lpatF0C1XiByg/rZz7gWCqg6Qhs2qh3Z+aRgSEBgSQJeBXyifW+J+gOcsNaMkxWNhj P+xIowNqcPe23qQfC80Y9iJUYj8Wsi4nMQuK2h4+NHTjDBXg0ovBRtUrqlr2SpiZEFPO rJsEslshj2xJnNpVdM7qDHkI0ZpnVqHZTGN2u7/xxmR7fHF0xNPHVI/enhVW2dXmMYBb dl8pHspIv0y+4ZemCNL+jT0IPVdbkBY8mAQlrTZg9i0QsIedS6T/n8i4KtndV2C6ZMmq v9lg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:to:from:sender:x-gm-message-state:from:to :cc:subject:date:message-id:reply-to; bh=1FcZyRQeOQ9/ocTYIJrm9hAsEhwnL7JTetk+CZq3ENQ=; b=MTGE9iQGrH0AEUWHPFqvMYIushYQ7FILQi2PKyamr735abQhP3LmDJn+B/AHbdO6uG YWgiko38hzSaPWYgkQbolzB+Plm8I9WT91t6GDPSzQpjRtlr4dukto/BY07aSOyT5EDo na6+IGF9R2hQLm399/UYirrJCNGiPKE13LK/L8s+6cAKV7SKsvSHo607I+2TGSkeQLDi IzwEA/jjsbHWDBHClFtBtRpv7QClKzGvInrxvx2eEomrexbgHlrDU3jRtBiZMoa5zt2g 2H9Qm8bnNGxk0X2TWD8hNdLm/xPhHP/xjahYcUGZhR8a3cVZbLgyOqu0K5W5DZyKle9K LMyg== X-Gm-Message-State: AFqh2kqWyTirPF367Tek2uDWqAAovVJDQpoisM8WAu4BZ9vMx773vKBz XWzvgp2fnTxkOEFdiSC5ZKGYato388m+3Q== X-Google-Smtp-Source: AMrXdXv85adxVfDKwWVe/3/1BDg/2O7zpY+N2xbPNtDaOvVtuFkT9YGWHzA2eF7iwj1xbGzu2FCKEg== X-Received: by 2002:a17:902:7c8a:b0:192:835d:c861 with SMTP id y10-20020a1709027c8a00b00192835dc861mr48492290pll.68.1673345918674; Tue, 10 Jan 2023 02:18:38 -0800 (PST) Received: from localhost ([2001:67c:1560:8007::aac:c469]) by smtp.gmail.com with ESMTPSA id k7-20020a170902ce0700b001885d15e3c1sm7761612plg.26.2023.01.10.02.18.36 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 10 Jan 2023 02:18:38 -0800 (PST) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 5/9][SRU][L][OEM-6.1] drm/i915: Extend dual PPS handlind for ICP+ Date: Tue, 10 Jan 2023 18:17:51 +0800 Message-Id: <20230110101755.1107104-6-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230110101755.1107104-1-acelan.kao@canonical.com> References: <20230110101755.1107104-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.216.50; envelope-from=acelan@gmail.com; helo=mail-pj1-f50.google.com X-BeenThere: kernel-team@lists.ubuntu.com X-Mailman-Version: 2.1.20 Precedence: list List-Id: Kernel team discussions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: kernel-team-bounces@lists.ubuntu.com Sender: "kernel-team" From: Ville Syrjälä BugLink: https://launchpad.net/bugs/2001599 On the PCH side the second PPS was introduced in ICP. Let's make sure we examine both power sequencer on ICP+ as well. Note that DG1/2 south block only has the single PPS, so need to exclude the fake DG1/2 PCHs. Cc: Animesh Manna Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221125173156.31689-6-ville.syrjala@linux.intel.com Reviewed-by: Animesh Manna (cherry picked from commit d83804f22d8532a8feb49ee5f552b41f3df41008 drm-tip) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/i915/display/intel_pps.c | 44 +++++++++++++++++------- 1 file changed, 32 insertions(+), 12 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c index a97acf503f668..64e99cd938f53 100644 --- a/drivers/gpu/drm/i915/display/intel_pps.c +++ b/drivers/gpu/drm/i915/display/intel_pps.c @@ -308,10 +308,27 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) pipe_name(intel_dp->pps.pps_pipe)); } +static int intel_num_pps(struct drm_i915_private *i915) +{ + if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) + return 2; + + if (IS_GEMINILAKE(i915) || IS_BROXTON(i915)) + return 2; + + if (INTEL_PCH_TYPE(i915) >= PCH_DG1) + return 1; + + if (INTEL_PCH_TYPE(i915) >= PCH_ICP) + return 2; + + return 1; +} + static int bxt_initial_pps_idx(struct drm_i915_private *i915, pps_check check) { - int pps_idx, pps_num = 2; + int pps_idx, pps_num = intel_num_pps(i915); for (pps_idx = 0; pps_idx < pps_num; pps_idx++) { if (check(i915, pps_idx)) @@ -335,12 +352,13 @@ pps_initial_setup(struct intel_dp *intel_dp) return; } - if (!IS_GEMINILAKE(i915) && !IS_BROXTON(i915)) - return; - /* first ask the VBT */ - intel_dp->pps.pps_idx = connector->panel.vbt.backlight.controller; - if (drm_WARN_ON(&i915->drm, intel_dp->pps.pps_idx >= 2)) + if (intel_num_pps(i915) > 1) + intel_dp->pps.pps_idx = connector->panel.vbt.backlight.controller; + else + intel_dp->pps.pps_idx = 0; + + if (drm_WARN_ON(&i915->drm, intel_dp->pps.pps_idx >= intel_num_pps(i915))) intel_dp->pps.pps_idx = -1; /* VBT wasn't parsed yet? pick one where the panel is on */ @@ -414,7 +432,7 @@ static void intel_pps_get_registers(struct intel_dp *intel_dp, struct pps_registers *regs) { struct drm_i915_private *dev_priv = dp_to_i915(intel_dp); - int pps_idx = 0; + int pps_idx; memset(regs, 0, sizeof(*regs)); @@ -422,6 +440,8 @@ static void intel_pps_get_registers(struct intel_dp *intel_dp, pps_idx = vlv_power_sequencer_pipe(intel_dp); else if (IS_GEMINILAKE(dev_priv) || IS_BROXTON(dev_priv)) pps_idx = bxt_power_sequencer_idx(intel_dp); + else + pps_idx = intel_dp->pps.pps_idx; regs->pp_ctrl = PP_CONTROL(pps_idx); regs->pp_stat = PP_STATUS(pps_idx); @@ -1500,7 +1520,10 @@ static void pps_init_late(struct intel_dp *intel_dp) struct intel_encoder *encoder = &dp_to_dig_port(intel_dp)->base; struct intel_connector *connector = intel_dp->attached_connector; - if (!IS_GEMINILAKE(i915) && !IS_BROXTON(i915)) + if (IS_VALLEYVIEW(i915) || IS_CHERRYVIEW(i915)) + return; + + if (intel_num_pps(i915) < 2) return; drm_WARN(&i915->drm, connector->panel.vbt.backlight.controller >= 0 && @@ -1543,10 +1566,7 @@ void intel_pps_unlock_regs_wa(struct drm_i915_private *dev_priv) * This w/a is needed at least on CPT/PPT, but to be sure apply it * everywhere where registers can be write protected. */ - if (IS_VALLEYVIEW(dev_priv) || IS_CHERRYVIEW(dev_priv)) - pps_num = 2; - else - pps_num = 1; + pps_num = intel_num_pps(dev_priv); for (pps_idx = 0; pps_idx < pps_num; pps_idx++) { u32 val = intel_de_read(dev_priv, PP_CONTROL(pps_idx));