Received: by 2002:a05:6358:4e97:b0:b3:742d:4702 with SMTP id ce23csp3349780rwb; Tue, 16 Aug 2022 00:58:03 -0700 (PDT) X-Google-Smtp-Source: AA6agR6Z7N6+61TxyMqdF/22TWWA5LMGpEe8cnQe6ID+ahOTrHJalKOlFk6+UeSUmkkniCfE4uji X-Received: by 2002:a63:ba49:0:b0:41c:2713:3984 with SMTP id l9-20020a63ba49000000b0041c27133984mr16698695pgu.468.1660636682905; Tue, 16 Aug 2022 00:58:02 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1660636682; cv=none; d=google.com; s=arc-20160816; b=k0TJcphRYEgAtIoFJ2rLJIMabweOT0kcXcCzG2+5bmh0PIMgroG76QOxY6Pk3vzX7w AVNdBIo+KoF0/JLqdp/HIW87ygY4303sLHPWP0xgaTk3CxByjOMjpmc6wo0upGGcN/Zp PskikH+iPtlvkaajlIPcrCT0C5o+ANnEPDGf5DM/8H7HpF1AKPJUOdFjYPJp4FKAn9BZ FPzV2wwx//G7jxtP9Hi8BFZSXjl6L9FUHdxO8DCor2hrk5UFFn/qlilQJFKKXcC4W34l CByO4Wo4yEUG28avlDP5bS+3cAzypAIm72WGnS0lT0PbzMK4OzmNUkDfVNUafikSewZo DPjQ== 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 :message-id:date:subject:cc:to:from:dkim-signature; bh=IQLHeSHMCgVndEybNXy3VEpy6W3eNIybZWGGP1wHszU=; b=ehFp7bZ8Yqrn2Q78XjP059fB/KnTJoOKSNOrLQO14VKxe+yVtmKCnS6cOMYDO8kapL Rp/KhJMW0FM5kBGDOXDzyqPVf1VQSECBXW8fMBv6JAXljtgGIWCao8EmGpZjzN9ugwMX 9j/TUj/OGXELLMMbYSWff7KRLEyb8NwAFD/ote2cL/0TT8E3jMyA9rBxJFLlyb5/OWwZ +BzxIQmfesV9fehZtZPXJp7LRdLxrjy7wdhHmo4lL1BVlTBlk5gMlSt5+bfN/8Jrh6U/ emlELDWEYleqUdGoL7nCcSjoU+NIKsjmZHil/dN3E51ahBbD/Ilj8knpl1+zWAeCIxe0 XLKw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=JKzWmfhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q18-20020a056a00089200b00527d4769260si11780557pfj.332.2022.08.16.00.57.52; Tue, 16 Aug 2022 00:58:02 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@canonical.com header.s=20210705 header.b=JKzWmfhn; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=canonical.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229659AbiHPHDn (ORCPT + 99 others); Tue, 16 Aug 2022 03:03:43 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51610 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231532AbiHPHDV (ORCPT ); Tue, 16 Aug 2022 03:03:21 -0400 Received: from smtp-relay-canonical-0.canonical.com (smtp-relay-canonical-0.canonical.com [185.125.188.120]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id A5725140BE1 for ; Mon, 15 Aug 2022 19:53:11 -0700 (PDT) Received: from localhost.localdomain (unknown [10.101.196.174]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by smtp-relay-canonical-0.canonical.com (Postfix) with ESMTPSA id 832BB3F0C6; Tue, 16 Aug 2022 02:53:04 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=canonical.com; s=20210705; t=1660618389; bh=IQLHeSHMCgVndEybNXy3VEpy6W3eNIybZWGGP1wHszU=; h=From:To:Cc:Subject:Date:Message-Id:MIME-Version; b=JKzWmfhnLy7p+XWRftjo55h4+OEj/1ovUfur4+PYJ8YkxvpB5MfEWaDR9WZXVVGeL oWSS0jQ5KPFiirXbOkySLddOYxRWeCO8UwVm0rO9TyB1Kx61jzqCQew0boTcklHG/X WmaFe1Bbu6Un4U0SBPOQ87JdVyS5Zot1PEJHjoMSTqOKzJeVMzCBiS7Wovvp6NZFWo QdSa/Hxxx0qzVFovhz1ojJ7WlXi8vQvI4EGhbbs0F1/4IGw4SfNISBnLM0tn4PSb/Y rqRn8I3SwT1zk0ywcNZS1XBsWsMGH/toefKJv4/qjkpSvSWZBTX6tKCxzh346VG/fT sSaiDteA7uhzQ== From: Kai-Heng Feng To: jani.nikula@linux.intel.com, joonas.lahtinen@linux.intel.com, rodrigo.vivi@intel.com, tvrtko.ursulin@linux.intel.com Cc: Kai-Heng Feng , David Airlie , Daniel Vetter , =?UTF-8?q?Ville=20Syrj=C3=A4l=C3=A4?= , Zenghui Yu , Lyude Paul , Hans de Goede , Heikki Krogerus , intel-gfx@lists.freedesktop.org, dri-devel@lists.freedesktop.org, linux-kernel@vger.kernel.org Subject: [PATCH] drm/i915: Switch TGL-H DP-IN to dGFX when it's supported Date: Tue, 16 Aug 2022 10:52:16 +0800 Message-Id: <20220816025217.618181-1-kai.heng.feng@canonical.com> X-Mailer: git-send-email 2.36.1 MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On mobile workstations like HP ZBook Fury G8, iGFX's DP-IN can switch to dGFX so external monitors are routed to dGFX, and more monitors can be supported as result. To switch the DP-IN to dGFX, the driver needs to invoke _DSM function 20 on intel_dsm_guid2. This method is described in Intel document 632107. Signed-off-by: Kai-Heng Feng --- drivers/gpu/drm/i915/display/intel_acpi.c | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/drivers/gpu/drm/i915/display/intel_acpi.c b/drivers/gpu/drm/i915/display/intel_acpi.c index e78430001f077..3bd5930e2769b 100644 --- a/drivers/gpu/drm/i915/display/intel_acpi.c +++ b/drivers/gpu/drm/i915/display/intel_acpi.c @@ -20,6 +20,7 @@ static const guid_t intel_dsm_guid = 0xa8, 0x54, 0x0f, 0x13, 0x17, 0xb0, 0x1c, 0x2c); #define INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED 0 /* No args */ +#define INTEL_DSM_FN_DP_IN_SWITCH_TO_DGFX 20 /* No args */ static const guid_t intel_dsm_guid2 = GUID_INIT(0x3e5b41c6, 0xeb1d, 0x4260, @@ -187,6 +188,7 @@ void intel_dsm_get_bios_data_funcs_supported(struct drm_i915_private *i915) struct pci_dev *pdev = to_pci_dev(i915->drm.dev); acpi_handle dhandle; union acpi_object *obj; + int supported = 0; dhandle = ACPI_HANDLE(&pdev->dev); if (!dhandle) @@ -194,8 +196,22 @@ void intel_dsm_get_bios_data_funcs_supported(struct drm_i915_private *i915) obj = acpi_evaluate_dsm(dhandle, &intel_dsm_guid2, INTEL_DSM_REVISION_ID, INTEL_DSM_FN_GET_BIOS_DATA_FUNCS_SUPPORTED, NULL); - if (obj) + if (obj) { + if (obj->type == ACPI_TYPE_INTEGER) + supported = obj->integer.value; + ACPI_FREE(obj); + } + + /* Tiger Lake H DP-IN Boot Time Switching from iGfx to dGfx */ + if (supported & BIT(20)) { + obj = acpi_evaluate_dsm(dhandle, &intel_dsm_guid2, + INTEL_DSM_REVISION_ID, + INTEL_DSM_FN_DP_IN_SWITCH_TO_DGFX, + NULL); + if (obj) + ACPI_FREE(obj); + } } /* -- 2.36.1