From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 05A8DECAAD8 for ; Fri, 23 Sep 2022 08:21:23 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 3465310E4D9; Fri, 23 Sep 2022 08:21:22 +0000 (UTC) Received: from mga18.intel.com (mga18.intel.com [134.134.136.126]) by gabe.freedesktop.org (Postfix) with ESMTPS id 6C38210E4D9 for ; Fri, 23 Sep 2022 08:21:18 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1663921278; x=1695457278; h=from:to:cc:subject:in-reply-to:references:date: message-id:mime-version; bh=WleXf7sQM48StY8JKaqB2KtfCXizea3jlohecqfPPFE=; b=HVXUau033+K0ycx8S6xrTrLenRnReQTuJ52yvkrb+5qrGeq32CEtX0ey oizqbK5CiSGA807a1OLXE09ZTEd2UKv6QNbSLAD5kVB0lNrU/v6hZ3UVi ky1e4EhZBZ1kuklSyyQaKfDnL4c4EpL3bgqFyLQR089Zy9H0DMFyFbywT ojWona4XgYnj6yZxyl12pxRoUAG4RCq4v1VX31/q+uYMOLkiyGBOfk/Wj QwuRvctW6JFFGOs55gH8tENgn3Y7GR2iV4e2iLhtF+GZQXdKLXtW8gKaL DXWf/yH5FXt9k32WfFxoejLmRKjSoR7ZdRh+ltoCSrZ+CRS6pWeDauvdI w==; X-IronPort-AV: E=McAfee;i="6500,9779,10478"; a="283639007" X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="283639007" Received: from orsmga008.jf.intel.com ([10.7.209.65]) by orsmga106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 01:21:17 -0700 X-IronPort-AV: E=Sophos;i="5.93,337,1654585200"; d="scan'208";a="650870968" Received: from armannov-mobl1.ger.corp.intel.com (HELO localhost) ([10.252.61.93]) by orsmga008-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Sep 2022 01:21:16 -0700 From: Jani Nikula To: Gustavo Sousa , intel-gfx@lists.freedesktop.org In-Reply-To: <20220922164949.163985-1-gustavo.sousa@intel.com> Organization: Intel Finland Oy - BIC 0357606-4 - Westendinkatu 7, 02160 Espoo References: <20220922164949.163985-1-gustavo.sousa@intel.com> Date: Fri, 23 Sep 2022 11:20:57 +0300 Message-ID: <87o7v64i3a.fsf@intel.com> MIME-Version: 1.0 Content-Type: text/plain Subject: Re: [Intel-gfx] [PATCH v2] drm/i915: Move hotplug inversion logic into separate helper X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Lucas De Marchi Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" On Thu, 22 Sep 2022, Gustavo Sousa wrote: > Use *_hpd_invert() helpers whenever possible to isolate logic specific > to hotplug inversion from common HPD setup logic to improve readability > and maintainability of the source code. > > While we only define dg1_hpd_invert() here, future platforms are likely > to have different hotplug inversion needs, thus it makes sense grouping > different implementations under a common suffix. > > v2: Fix coding style and prefer to use small *_hdp_invert() helpers > instead of a generic one. > > CC: Jani Nikula > CC: Lucas De Marchi > Signed-off-by: Gustavo Sousa Reviewed-by: Jani Nikula > --- > drivers/gpu/drm/i915/i915_irq.c | 19 ++++++++++--------- > 1 file changed, 10 insertions(+), 9 deletions(-) > > diff --git a/drivers/gpu/drm/i915/i915_irq.c b/drivers/gpu/drm/i915/i915_irq.c > index de06f293e173..87cb05b3b6ce 100644 > --- a/drivers/gpu/drm/i915/i915_irq.c > +++ b/drivers/gpu/drm/i915/i915_irq.c > @@ -3411,17 +3411,18 @@ static u32 gen11_hotplug_enables(struct drm_i915_private *i915, > } > } > > +static void dg1_hpd_invert(struct drm_i915_private *i915) > +{ > + u32 val = (INVERT_DDIA_HPD | > + INVERT_DDIB_HPD | > + INVERT_DDIC_HPD | > + INVERT_DDID_HPD); > + intel_uncore_rmw(&i915->uncore, SOUTH_CHICKEN1, 0, val); > +} > + > static void dg1_hpd_irq_setup(struct drm_i915_private *dev_priv) > { > - u32 val; > - > - val = intel_uncore_read(&dev_priv->uncore, SOUTH_CHICKEN1); > - val |= (INVERT_DDIA_HPD | > - INVERT_DDIB_HPD | > - INVERT_DDIC_HPD | > - INVERT_DDID_HPD); > - intel_uncore_write(&dev_priv->uncore, SOUTH_CHICKEN1, val); > - > + dg1_hpd_invert(dev_priv); > icp_hpd_irq_setup(dev_priv); > } -- Jani Nikula, Intel Open Source Graphics Center