From patchwork Fri Feb 22 15:52:49 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: =?utf-8?b?VmlsbGUgU3lyasOkbMOk?= X-Patchwork-Id: 10826475 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E1E4917E9 for ; Fri, 22 Feb 2019 15:53:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id CFCBF32953 for ; Fri, 22 Feb 2019 15:53:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C3E6732956; Fri, 22 Feb 2019 15:53:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-5.2 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_MED autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) (using TLSv1.2 with cipher DHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 6DB6132953 for ; Fri, 22 Feb 2019 15:53:00 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id C3EEF89711; Fri, 22 Feb 2019 15:52:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mga11.intel.com (mga11.intel.com [192.55.52.93]) by gabe.freedesktop.org (Postfix) with ESMTPS id 5A7C189711 for ; Fri, 22 Feb 2019 15:52:58 +0000 (UTC) X-Amp-Result: SKIPPED(no attachment in message) X-Amp-File-Uploaded: False Received: from orsmga007.jf.intel.com ([10.7.209.58]) by fmsmga102.fm.intel.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 22 Feb 2019 07:52:58 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="5.58,400,1544515200"; d="scan'208";a="117016196" Received: from stinkbox.fi.intel.com (HELO stinkbox) ([10.237.72.174]) by orsmga007.jf.intel.com with SMTP; 22 Feb 2019 07:52:56 -0800 Received: by stinkbox (sSMTP sendmail emulation); Fri, 22 Feb 2019 17:52:55 +0200 From: Ville Syrjala To: intel-gfx@lists.freedesktop.org Date: Fri, 22 Feb 2019 17:52:49 +0200 Message-Id: <20190222155251.16730-2-ville.syrjala@linux.intel.com> X-Mailer: git-send-email 2.19.2 In-Reply-To: <20190222155251.16730-1-ville.syrjala@linux.intel.com> References: <20190222155251.16730-1-ville.syrjala@linux.intel.com> MIME-Version: 1.0 Subject: [Intel-gfx] [PATCH 2/4] drm/i915: Generalize pci quirks X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP From: Ville Syrjälä Add support for multiple independent pci quirk tables. I want to reuse the quirk table approach for some watermark quirks but I prefer to keep the details in one place rather than spreading them all over. Signed-off-by: Ville Syrjälä Reviewed-by: Jani Nikula --- drivers/gpu/drm/i915/intel_drv.h | 9 +++++++++ drivers/gpu/drm/i915/intel_quirks.c | 28 +++++++++++++++------------- 2 files changed, 24 insertions(+), 13 deletions(-) diff --git a/drivers/gpu/drm/i915/intel_drv.h b/drivers/gpu/drm/i915/intel_drv.h index 81ec73e4a083..8924b43d6e99 100644 --- a/drivers/gpu/drm/i915/intel_drv.h +++ b/drivers/gpu/drm/i915/intel_drv.h @@ -2187,7 +2187,16 @@ int intel_psr_wait_for_idle(const struct intel_crtc_state *new_crtc_state, bool intel_psr_enabled(struct intel_dp *intel_dp); /* intel_quirks.c */ +struct intel_pci_quirk { + int device; + int subsystem_vendor; + int subsystem_device; + void (*hook)(struct drm_i915_private *i915); +}; + void intel_init_quirks(struct drm_i915_private *dev_priv); +void intel_apply_pci_quirks(struct drm_i915_private *i915, + const struct intel_pci_quirk *quirks); /* intel_runtime_pm.c */ void intel_runtime_pm_init_early(struct drm_i915_private *dev_priv); diff --git a/drivers/gpu/drm/i915/intel_quirks.c b/drivers/gpu/drm/i915/intel_quirks.c index ec2b0fc92b8b..e073510553a6 100644 --- a/drivers/gpu/drm/i915/intel_quirks.c +++ b/drivers/gpu/drm/i915/intel_quirks.c @@ -52,13 +52,6 @@ static void quirk_increase_ddi_disabled_time(struct drm_i915_private *i915) DRM_INFO("Applying Increase DDI Disabled quirk\n"); } -struct intel_quirk { - int device; - int subsystem_vendor; - int subsystem_device; - void (*hook)(struct drm_i915_private *i915); -}; - /* For systems that don't have a meaningful PCI subdevice/subvendor ID */ struct intel_dmi_quirk { void (*hook)(struct drm_i915_private *i915); @@ -87,7 +80,7 @@ static const struct intel_dmi_quirk intel_dmi_quirks[] = { }, }; -static struct intel_quirk intel_quirks[] = { +static const struct intel_pci_quirk intel_pci_quirks[] = { /* Lenovo U160 cannot use SSC on LVDS */ { 0x0046, 0x17aa, 0x3920, quirk_ssc_force_disable }, @@ -145,16 +138,17 @@ static struct intel_quirk intel_quirks[] = { /* ASRock ITX*/ { 0x3185, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, { 0x3184, 0x1849, 0x2212, quirk_increase_ddi_disabled_time }, + + {} }; -void intel_init_quirks(struct drm_i915_private *i915) +void intel_apply_pci_quirks(struct drm_i915_private *i915, + const struct intel_pci_quirk *quirks) { struct pci_dev *d = i915->drm.pdev; - int i; - - for (i = 0; i < ARRAY_SIZE(intel_quirks); i++) { - struct intel_quirk *q = &intel_quirks[i]; + const struct intel_pci_quirk *q; + for (q = quirks; q->device; q++) { if (d->device == q->device && (d->subsystem_vendor == q->subsystem_vendor || q->subsystem_vendor == PCI_ANY_ID) && @@ -162,6 +156,14 @@ void intel_init_quirks(struct drm_i915_private *i915) q->subsystem_device == PCI_ANY_ID)) q->hook(i915); } +} + +void intel_init_quirks(struct drm_i915_private *i915) +{ + int i; + + intel_apply_pci_quirks(i915, intel_pci_quirks); + for (i = 0; i < ARRAY_SIZE(intel_dmi_quirks); i++) { if (dmi_check_system(*intel_dmi_quirks[i].dmi_id_list) != 0) intel_dmi_quirks[i].hook(i915);