From patchwork Tue Mar 28 08:32:40 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: AceLan Kao X-Patchwork-Id: 1762200 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=UQeAApyM; 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 4Pm2xx40Dtz1yYr for ; Tue, 28 Mar 2023 19:33:08 +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 1ph4lH-0008BF-Eq; Tue, 28 Mar 2023 08:32:59 +0000 Received: from mail-pf1-f177.google.com ([209.85.210.177]) by huckleberry.canonical.com with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.86_2) (envelope-from ) id 1ph4lE-00089g-ID for kernel-team@lists.ubuntu.com; Tue, 28 Mar 2023 08:32:56 +0000 Received: by mail-pf1-f177.google.com with SMTP id g7so7427399pfu.2 for ; Tue, 28 Mar 2023 01:32:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; t=1679992374; 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=wUESv+fgtG4hiAnXl8j0OXxEwSW9PFubjHjr4W6FdI8=; b=UQeAApyMvzIffK5IHlg4HeU4D24uMzJnyQ1J4+fw4miNV9VcsE+DfUld4VN/yBc0H6 QSExgIpKFQPpiVMccZNwhUYopVIWvjyZiH1DZ4MKAM1tFJVCg7cfGHOiiAdAsnYaqNG3 ijArJ5msfUduhJvflm3N4GQGsNHCM9or09iWKPiHuZZ4lxTalyj5zALC93mE3f8gjtgi 3PRht/Je+W8ixGj8J4ByQc0+VAIXkhgRGco+il2ywAbh6/3b1lvOWkPIxZA5TzdkeTm2 3zuJlz8gcs4owY34MO20Km+8T8jt2zu378+8K0b7o81enSA04lmFYyPSjY7uA3rMAAJY T+DA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; t=1679992374; 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=wUESv+fgtG4hiAnXl8j0OXxEwSW9PFubjHjr4W6FdI8=; b=llP/LS7XaoiPaQDHzkrHCVTk6j1QA83zFSrjAZTC5LPT51aJoa2Je0WcamXhYiDBsB Ivc5TLxuhb5ruCDQhDOTdPkeUYLXi2gGojgOo9OJNYGy/rMxHXF3iRWyJX/0cMWY3Niq xspzaX99Gq1azoivOqWJtKw/i5JqSPhlW1KTgFAEqST1O82O3/omWpE9T38UQ88RpWpt +KisJJE9vzyduhyU5HRjQ+4wTvEiNAxJ8qg6UWp9WlvYu5IUk+LizOe1FPVb/aVm9cr1 yssV5iCPYK/hiZLsL9TrUgLRgZiM4Noywg2EhjWf5MDScdw50vVGUbVl0RpciWJJA3iB nMZw== X-Gm-Message-State: AAQBX9cm4BA4lN2Hij3ajB6TQcm7pldtM+uHJ76IFdzpOTouA3f3pg40 OvetANAq9g4dv5UEJzQRO4sUzisgKR1kAQ== X-Google-Smtp-Source: AKy350YR61Le+szri3mBtN/UhlNnzZJSBzo0WsQYhiBdd2hwSwUO7swEdR5zsK0t0HyyQELpjnJwNA== X-Received: by 2002:a62:1a10:0:b0:625:e77b:433e with SMTP id a16-20020a621a10000000b00625e77b433emr12981097pfa.24.1679992374638; Tue, 28 Mar 2023 01:32:54 -0700 (PDT) Received: from localhost (220-135-95-34.hinet-ip.hinet.net. [220.135.95.34]) by smtp.gmail.com with ESMTPSA id i25-20020aa79099000000b0062d7c0dc4f2sm3906693pfa.79.2023.03.28.01.32.54 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 28 Mar 2023 01:32:54 -0700 (PDT) From: AceLan Kao To: kernel-team@lists.ubuntu.com Subject: [PATCH 3/9][SRU][L] drm/i915: Generalize the PPS vlv_pipe_check() stuff Date: Tue, 28 Mar 2023 16:32:40 +0800 Message-Id: <20230328083246.366669-4-acelan.kao@canonical.com> X-Mailer: git-send-email 2.34.1 In-Reply-To: <20230328083246.366669-1-acelan.kao@canonical.com> References: <20230328083246.366669-1-acelan.kao@canonical.com> MIME-Version: 1.0 Received-SPF: pass client-ip=209.85.210.177; envelope-from=acelan@gmail.com; helo=mail-pf1-f177.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 Restate the vlv_pipe_check() stuff in terms of PPS index (rather than pipe, which it is on VLV/CHV) so that we can reuse this same mechanim on other platforms as well. Cc: Animesh Manna Reviewed-by: Jani Nikula Signed-off-by: Ville Syrjälä Link: https://patchwork.freedesktop.org/patch/msgid/20221125173156.31689-4-ville.syrjala@linux.intel.com (cherry picked from commit 209074fd5a8217688b9ee5c200d470df3e32dee1) Signed-off-by: Chia-Lin Kao (AceLan) --- drivers/gpu/drm/i915/display/intel_pps.c | 27 ++++++++++-------------- 1 file changed, 11 insertions(+), 16 deletions(-) diff --git a/drivers/gpu/drm/i915/display/intel_pps.c b/drivers/gpu/drm/i915/display/intel_pps.c index 9bbf41a076f7..41ab12fcce0e 100644 --- a/drivers/gpu/drm/i915/display/intel_pps.c +++ b/drivers/gpu/drm/i915/display/intel_pps.c @@ -234,31 +234,26 @@ bxt_power_sequencer_idx(struct intel_dp *intel_dp) return backlight_controller; } -typedef bool (*vlv_pipe_check)(struct drm_i915_private *dev_priv, - enum pipe pipe); +typedef bool (*pps_check)(struct drm_i915_private *dev_priv, int pps_idx); -static bool vlv_pipe_has_pp_on(struct drm_i915_private *dev_priv, - enum pipe pipe) +static bool pps_has_pp_on(struct drm_i915_private *dev_priv, int pps_idx) { - return intel_de_read(dev_priv, PP_STATUS(pipe)) & PP_ON; + return intel_de_read(dev_priv, PP_STATUS(pps_idx)) & PP_ON; } -static bool vlv_pipe_has_vdd_on(struct drm_i915_private *dev_priv, - enum pipe pipe) +static bool pps_has_vdd_on(struct drm_i915_private *dev_priv, int pps_idx) { - return intel_de_read(dev_priv, PP_CONTROL(pipe)) & EDP_FORCE_VDD; + return intel_de_read(dev_priv, PP_CONTROL(pps_idx)) & EDP_FORCE_VDD; } -static bool vlv_pipe_any(struct drm_i915_private *dev_priv, - enum pipe pipe) +static bool pps_any(struct drm_i915_private *dev_priv, int pps_idx) { return true; } static enum pipe vlv_initial_pps_pipe(struct drm_i915_private *dev_priv, - enum port port, - vlv_pipe_check pipe_check) + enum port port, pps_check check) { enum pipe pipe; @@ -269,7 +264,7 @@ vlv_initial_pps_pipe(struct drm_i915_private *dev_priv, if (port_sel != PANEL_PORT_SELECT_VLV(port)) continue; - if (!pipe_check(dev_priv, pipe)) + if (!check(dev_priv, pipe)) continue; return pipe; @@ -290,15 +285,15 @@ vlv_initial_power_sequencer_setup(struct intel_dp *intel_dp) /* try to find a pipe with this port selected */ /* first pick one where the panel is on */ intel_dp->pps.pps_pipe = vlv_initial_pps_pipe(dev_priv, port, - vlv_pipe_has_pp_on); + pps_has_pp_on); /* didn't find one? pick one where vdd is on */ if (intel_dp->pps.pps_pipe == INVALID_PIPE) intel_dp->pps.pps_pipe = vlv_initial_pps_pipe(dev_priv, port, - vlv_pipe_has_vdd_on); + pps_has_vdd_on); /* didn't find one? pick one with just the correct port */ if (intel_dp->pps.pps_pipe == INVALID_PIPE) intel_dp->pps.pps_pipe = vlv_initial_pps_pipe(dev_priv, port, - vlv_pipe_any); + pps_any); /* didn't find one? just let vlv_power_sequencer_pipe() pick one when needed */ if (intel_dp->pps.pps_pipe == INVALID_PIPE) {