summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPeter Wu <peter@lekensteyn.nl>2016-05-24 18:12:57 +0200
committerPeter Wu <peter@lekensteyn.nl>2016-05-24 21:34:57 +0200
commitcb4933926f1cf117e3607d679820d2c1d7be0aba (patch)
tree563ed0760c1c23ec9c5271a641a5a409b909e402
parent2548cdf5b3c9236abe5cd9c1f4ecb4d209849ccd (diff)
downloadlinux-cb4933926f1cf117e3607d679820d2c1d7be0aba.tar.gz
drm/nouveau/acpi: return supported DSM functions
Return the set of supported functions to the caller. No functional changes. Signed-off-by: Peter Wu <peter@lekensteyn.nl>
-rw-r--r--drivers/gpu/drm/nouveau/nouveau_acpi.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/drivers/gpu/drm/nouveau/nouveau_acpi.c b/drivers/gpu/drm/nouveau/nouveau_acpi.c
index 45fa9b2f6edb..71d5e6a142c5 100644
--- a/drivers/gpu/drm/nouveau/nouveau_acpi.c
+++ b/drivers/gpu/drm/nouveau/nouveau_acpi.c
@@ -107,7 +107,7 @@ static int nouveau_optimus_dsm(acpi_handle handle, int func, int arg, uint32_t *
* requirements on the fourth parameter, so a private implementation
* instead of using acpi_check_dsm().
*/
-static int nouveau_check_optimus_dsm(acpi_handle handle)
+static int nouveau_dsm_get_optimus_functions(acpi_handle handle)
{
int result;
@@ -122,7 +122,9 @@ static int nouveau_check_optimus_dsm(acpi_handle handle)
* ACPI Spec v4 9.14.1: if bit 0 is zero, no function is supported.
* If the n-th bit is enabled, function n is supported
*/
- return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);
+ if (result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS))
+ return result;
+ return 0;
}
static int nouveau_dsm(acpi_handle handle, int func, int arg)
@@ -214,7 +216,7 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, bool *has_mux,
{
acpi_handle dhandle;
bool supports_mux;
- bool supports_opt;
+ int optimus_funcs;
dhandle = ACPI_HANDLE(&pdev->dev);
if (!dhandle)
@@ -225,17 +227,17 @@ static void nouveau_dsm_pci_probe(struct pci_dev *pdev, bool *has_mux,
supports_mux = acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
1 << NOUVEAU_DSM_POWER);
- supports_opt = nouveau_check_optimus_dsm(dhandle);
+ optimus_funcs = nouveau_dsm_get_optimus_functions(dhandle);
/* Does not look like a Nvidia device. */
- if (!supports_mux && !supports_opt)
+ if (!supports_mux && !optimus_funcs)
return;
nouveau_dsm_priv.dhandle = dhandle;
*has_mux = supports_mux;
- *has_opt = supports_opt;
+ *has_opt = !!optimus_funcs;
- if (supports_opt) {
+ if (optimus_funcs) {
uint32_t result;
nouveau_optimus_dsm(dhandle, NOUVEAU_DSM_OPTIMUS_CAPS, 0,
&result);