All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pierre Moreau <pierre.morrow@free.fr>
To: nouveau@lists.freedesktop.org
Cc: bskeggs@redhat.com, dri-devel@lists.freedesktop.org
Subject: [PATCH 1/8] acpi: Rename v1 DSM to mux to avoid ambiguity
Date: Tue, 26 May 2015 00:22:46 +0200	[thread overview]
Message-ID: <1432592573-13743-1-git-send-email-pierre.morrow@free.fr> (raw)

This is especially true when variables or functions are just called dsm without
precising the v1.

Signed-off-by: Pierre Moreau <pierre.morrow@free.fr>
---
 drm/nouveau/nouveau_acpi.c | 64 +++++++++++++++++++++++-----------------------
 drm/nouveau/nouveau_acpi.h |  4 +--
 drm/nouveau/nouveau_drm.c  |  4 +--
 drm/nouveau/nouveau_vga.c  | 10 ++++----
 4 files changed, 41 insertions(+), 41 deletions(-)

diff --git a/drm/nouveau/nouveau_acpi.c b/drm/nouveau/nouveau_acpi.c
index 6224246..4a48e21 100644
--- a/drm/nouveau/nouveau_acpi.c
+++ b/drm/nouveau/nouveau_acpi.c
@@ -9,16 +9,16 @@
 #include "nouveau_drm.h"
 #include "nouveau_acpi.h"
 
-#define NOUVEAU_DSM_LED 0x02
-#define NOUVEAU_DSM_LED_STATE 0x00
-#define NOUVEAU_DSM_LED_OFF 0x10
-#define NOUVEAU_DSM_LED_STAMINA 0x11
-#define NOUVEAU_DSM_LED_SPEED 0x12
+#define NOUVEAU_DSM_MUX_LED 0x02
+#define NOUVEAU_DSM_MUX_LED_STATE 0x00
+#define NOUVEAU_DSM_MUX_LED_OFF 0x10
+#define NOUVEAU_DSM_MUX_LED_STAMINA 0x11
+#define NOUVEAU_DSM_MUX_LED_SPEED 0x12
 
-#define NOUVEAU_DSM_POWER 0x03
-#define NOUVEAU_DSM_POWER_STATE 0x00
-#define NOUVEAU_DSM_POWER_SPEED 0x01
-#define NOUVEAU_DSM_POWER_STAMINA 0x02
+#define NOUVEAU_DSM_MUX_POWER 0x03
+#define NOUVEAU_DSM_MUX_POWER_STATE 0x00
+#define NOUVEAU_DSM_MUX_POWER_SPEED 0x01
+#define NOUVEAU_DSM_MUX_POWER_STAMINA 0x02
 
 #define NOUVEAU_DSM_OPTIMUS_CAPS 0x1A
 #define NOUVEAU_DSM_OPTIMUS_FLAGS 0x1B
@@ -43,7 +43,7 @@
 #define OPTIMUS_HDA_CODEC_MASK (2 << 27) /* hda bios control */
 
 static struct nouveau_dsm_priv {
-	bool dsm_detected;
+	bool mux_detected;
 	bool optimus_detected;
 	acpi_handle dhandle;
 	acpi_handle rom_handle;
@@ -53,15 +53,15 @@ bool nouveau_is_optimus(void) {
 	return nouveau_dsm_priv.optimus_detected;
 }
 
-bool nouveau_is_v1_dsm(void) {
-	return nouveau_dsm_priv.dsm_detected;
+bool nouveau_has_mux(void) {
+	return nouveau_dsm_priv.mux_detected;
 }
 
 #define NOUVEAU_DSM_HAS_MUX 0x1
 #define NOUVEAU_DSM_HAS_OPT 0x2
 
 #ifdef CONFIG_VGA_SWITCHEROO
-static const char nouveau_dsm_muid[] = {
+static const char nouveau_mux_dsm_muid[] = {
 	0xA0, 0xA0, 0x95, 0x9D, 0x60, 0x00, 0x48, 0x4D,
 	0xB3, 0x4D, 0x7E, 0x5F, 0xEA, 0x12, 0x9F, 0xD4,
 };
@@ -128,7 +128,7 @@ static int nouveau_check_optimus_dsm(acpi_handle handle)
 	return result & 1 && result & (1 << NOUVEAU_DSM_OPTIMUS_CAPS);
 }
 
-static int nouveau_dsm(acpi_handle handle, int func, int arg)
+static int nouveau_mux_dsm(acpi_handle handle, int func, int arg)
 {
 	int ret = 0;
 	union acpi_object *obj;
@@ -137,7 +137,7 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg)
 		.integer.value = arg,
 	};
 
-	obj = acpi_evaluate_dsm_typed(handle, nouveau_dsm_muid, 0x00000102,
+	obj = acpi_evaluate_dsm_typed(handle, nouveau_mux_dsm_muid, 0x00000102,
 				      func, &argv4, ACPI_TYPE_INTEGER);
 	if (!obj) {
 		acpi_handle_info(handle, "failed to evaluate _DSM\n");
@@ -153,30 +153,30 @@ static int nouveau_dsm(acpi_handle handle, int func, int arg)
 
 static int nouveau_dsm_switch_mux(acpi_handle handle, int mux_id)
 {
-	mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
-	mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
-	return nouveau_dsm(handle, NOUVEAU_DSM_LED, mux_id);
+	mxm_wmi_call_mxmx(mux_id == NOUVEAU_DSM_MUX_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
+	mxm_wmi_call_mxds(mux_id == NOUVEAU_DSM_MUX_LED_STAMINA ? MXM_MXDS_ADAPTER_IGD : MXM_MXDS_ADAPTER_0);
+	return nouveau_mux_dsm(handle, NOUVEAU_DSM_MUX_LED, mux_id);
 }
 
 static int nouveau_dsm_set_discrete_state(acpi_handle handle, enum vga_switcheroo_state state)
 {
 	int arg;
 	if (state == VGA_SWITCHEROO_ON)
-		arg = NOUVEAU_DSM_POWER_SPEED;
+		arg = NOUVEAU_DSM_MUX_POWER_SPEED;
 	else
-		arg = NOUVEAU_DSM_POWER_STAMINA;
-	nouveau_dsm(handle, NOUVEAU_DSM_POWER, arg);
+		arg = NOUVEAU_DSM_MUX_POWER_STAMINA;
+	nouveau_mux_dsm(handle, NOUVEAU_DSM_MUX_POWER, arg);
 	return 0;
 }
 
 static int nouveau_dsm_switchto(enum vga_switcheroo_client_id id)
 {
-	if (!nouveau_dsm_priv.dsm_detected)
+	if (!nouveau_dsm_priv.mux_detected)
 		return 0;
 	if (id == VGA_SWITCHEROO_IGD)
-		return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_LED_STAMINA);
+		return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_MUX_LED_STAMINA);
 	else
-		return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_LED_SPEED);
+		return nouveau_dsm_switch_mux(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_MUX_LED_SPEED);
 }
 
 static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
@@ -187,7 +187,7 @@ static int nouveau_dsm_power_state(enum vga_switcheroo_client_id id,
 
 	/* Optimus laptops have the card already disabled in
 	 * nouveau_switcheroo_set_state */
-	if (!nouveau_dsm_priv.dsm_detected)
+	if (!nouveau_dsm_priv.mux_detected)
 		return 0;
 
 	return nouveau_dsm_set_discrete_state(nouveau_dsm_priv.dhandle, state);
@@ -224,8 +224,8 @@ static int nouveau_dsm_pci_probe(struct pci_dev *pdev)
 	if (!acpi_has_method(dhandle, "_DSM"))
 		return false;
 
-	if (acpi_check_dsm(dhandle, nouveau_dsm_muid, 0x00000102,
-			   1 << NOUVEAU_DSM_POWER))
+	if (acpi_check_dsm(dhandle, nouveau_mux_dsm_muid, 0x00000102,
+			   1 << NOUVEAU_DSM_MUX_POWER))
 		retval |= NOUVEAU_DSM_HAS_MUX;
 
 	if (nouveau_check_optimus_dsm(dhandle))
@@ -285,7 +285,7 @@ static bool nouveau_dsm_detect(void)
 			has_optimus = 1;
 	}
 
-	/* find the optimus DSM or the old v1 DSM */
+	/* find the optimus DSM or the mux DSM */
 	if (has_optimus == 1) {
 		acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME,
 			&buffer);
@@ -296,9 +296,9 @@ static bool nouveau_dsm_detect(void)
 	} else if (vga_count == 2 && has_dsm && guid_valid) {
 		acpi_get_name(nouveau_dsm_priv.dhandle, ACPI_FULL_PATHNAME,
 			&buffer);
-		printk(KERN_INFO "VGA switcheroo: detected DSM switching method %s handle\n",
+		printk(KERN_INFO "VGA switcheroo: detected mux DSM switching method %s handle\n",
 			acpi_method_name);
-		nouveau_dsm_priv.dsm_detected = true;
+		nouveau_dsm_priv.mux_detected = true;
 		ret = true;
 	}
 
@@ -328,13 +328,13 @@ void nouveau_switcheroo_optimus_dsm(void)
 			    0x3, &result);
 
 	nouveau_optimus_dsm(nouveau_dsm_priv.dhandle, NOUVEAU_DSM_OPTIMUS_CAPS,
-		NOUVEAU_DSM_OPTIMUS_SET_POWERDOWN, &result);
+			    NOUVEAU_DSM_OPTIMUS_SET_POWERDOWN, &result);
 
 }
 
 void nouveau_unregister_dsm_handler(void)
 {
-	if (nouveau_dsm_priv.optimus_detected || nouveau_dsm_priv.dsm_detected)
+	if (nouveau_dsm_priv.optimus_detected || nouveau_dsm_priv.mux_detected)
 		vga_switcheroo_unregister_handler();
 }
 #else
diff --git a/drm/nouveau/nouveau_acpi.h b/drm/nouveau/nouveau_acpi.h
index 74acf0f..2bd88a8 100644
--- a/drm/nouveau/nouveau_acpi.h
+++ b/drm/nouveau/nouveau_acpi.h
@@ -5,7 +5,7 @@
 
 #if defined(CONFIG_ACPI) && defined(CONFIG_X86)
 bool nouveau_is_optimus(void);
-bool nouveau_is_v1_dsm(void);
+bool nouveau_has_mux(void);
 void nouveau_register_dsm_handler(void);
 void nouveau_unregister_dsm_handler(void);
 void nouveau_switcheroo_optimus_dsm(void);
@@ -14,7 +14,7 @@ bool nouveau_acpi_rom_supported(struct pci_dev *pdev);
 void *nouveau_acpi_edid(struct drm_device *, struct drm_connector *);
 #else
 static inline bool nouveau_is_optimus(void) { return false; };
-static inline bool nouveau_is_v1_dsm(void) { return false; };
+static inline bool nouveau_has_mux(void) { return false; };
 static inline void nouveau_register_dsm_handler(void) {}
 static inline void nouveau_unregister_dsm_handler(void) {}
 static inline void nouveau_switcheroo_optimus_dsm(void) {}
diff --git a/drm/nouveau/nouveau_drm.c b/drm/nouveau/nouveau_drm.c
index 8904933..c06a7a1 100644
--- a/drm/nouveau/nouveau_drm.c
+++ b/drm/nouveau/nouveau_drm.c
@@ -719,7 +719,7 @@ nouveau_pmops_runtime_suspend(struct device *dev)
 	}
 
 	/* are we optimus enabled? */
-	if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
+	if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_has_mux()) {
 		DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
 		pm_runtime_forbid(dev);
 		return -EBUSY;
@@ -780,7 +780,7 @@ nouveau_pmops_runtime_idle(struct device *dev)
 	}
 
 	/* are we optimus enabled? */
-	if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_is_v1_dsm()) {
+	if (nouveau_runtime_pm == -1 && !nouveau_is_optimus() && !nouveau_has_mux()) {
 		DRM_DEBUG_DRIVER("failing to power off - not optimus\n");
 		pm_runtime_forbid(dev);
 		return -EBUSY;
diff --git a/drm/nouveau/nouveau_vga.c b/drm/nouveau/nouveau_vga.c
index c7592ec..6297566 100644
--- a/drm/nouveau/nouveau_vga.c
+++ b/drm/nouveau/nouveau_vga.c
@@ -36,7 +36,7 @@ nouveau_switcheroo_set_state(struct pci_dev *pdev,
 {
 	struct drm_device *dev = pci_get_drvdata(pdev);
 
-	if ((nouveau_is_optimus() || nouveau_is_v1_dsm()) && state == VGA_SWITCHEROO_OFF)
+	if ((nouveau_is_optimus() || nouveau_has_mux()) && state == VGA_SWITCHEROO_OFF)
 		return;
 
 	if (state == VGA_SWITCHEROO_ON) {
@@ -96,11 +96,11 @@ nouveau_vga_init(struct nouveau_drm *drm)
 
 	if (nouveau_runtime_pm == 1)
 		runtime = true;
-	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
+	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_has_mux()))
 		runtime = true;
 	vga_switcheroo_register_client(dev->pdev, &nouveau_switcheroo_ops, runtime);
 
-	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
+	if (runtime && nouveau_has_mux() && !nouveau_is_optimus())
 		vga_switcheroo_init_domain_pm_ops(drm->dev->dev, &drm->vga_pm_domain);
 }
 
@@ -112,11 +112,11 @@ nouveau_vga_fini(struct nouveau_drm *drm)
 
 	if (nouveau_runtime_pm == 1)
 		runtime = true;
-	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_is_v1_dsm()))
+	if ((nouveau_runtime_pm == -1) && (nouveau_is_optimus() || nouveau_has_mux()))
 		runtime = true;
 
 	vga_switcheroo_unregister_client(dev->pdev);
-	if (runtime && nouveau_is_v1_dsm() && !nouveau_is_optimus())
+	if (runtime && nouveau_has_mux() && !nouveau_is_optimus())
 		vga_switcheroo_fini_domain_pm_ops(drm->dev->dev);
 	vga_client_register(dev->pdev, NULL, NULL, NULL);
 }
-- 
2.4.1

_______________________________________________
dri-devel mailing list
dri-devel@lists.freedesktop.org
http://lists.freedesktop.org/mailman/listinfo/dri-devel

             reply	other threads:[~2015-05-25 22:22 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-05-25 22:22 Pierre Moreau [this message]
     [not found] ` <1432592573-13743-1-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-25 22:22   ` [PATCH 2/8] acpi: Add evaluate to functons evaluating _DSM Pierre Moreau
     [not found]     ` <1432592573-13743-2-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-26  8:01       ` Samuel Pitoiset
     [not found]         ` <5564284F.3080406-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-28  2:59           ` Dave Airlie
2015-05-25 22:22   ` [PATCH 5/8] acpi: Check returned object type by Optimus _DSM locally Pierre Moreau
2015-05-25 22:39     ` [Nouveau] " Ilia Mirkin
2015-05-26  5:10       ` Pierre Moreau
     [not found]         ` <84DFBDB0-0382-479C-8019-7CD888B7B466-GANU6spQydw@public.gmane.org>
2015-05-26  5:17           ` Ilia Mirkin
2015-05-26  8:26             ` [Nouveau] " Pierre Moreau
     [not found]               ` <754009E0-60CD-4E58-BA04-5FF8F3315E23-GANU6spQydw@public.gmane.org>
2015-05-28  3:03                 ` Dave Airlie
     [not found]     ` <1432592573-13743-5-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-26  8:08       ` Samuel Pitoiset
2015-05-25 22:22   ` [PATCH 8/8] acpi: Use booleans when probing different _DSM types Pierre Moreau
     [not found]     ` <1432592573-13743-8-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-26 12:46       ` Pierre Moreau
     [not found]         ` <1279603096.13154002.1432644369153.JavaMail.root-x5ewXQG5twBsFmKuirFwRhh1pbbyJDp15NbjCUgZEJk@public.gmane.org>
2015-05-26 20:42           ` Samuel Pitoiset
2015-05-25 22:22 ` [PATCH 3/8] acpi: Define static variables for revision ids Pierre Moreau
2015-05-28  2:59   ` [Nouveau] " Dave Airlie
2015-05-25 22:22 ` [PATCH 4/8] acpi: Allow evaluate_optimus_dsm to take NULL results Pierre Moreau
     [not found]   ` <1432592573-13743-4-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-26  8:02     ` Samuel Pitoiset
2015-05-26  8:27       ` [Nouveau] " Pierre Moreau
2015-05-25 22:22 ` [PATCH 6/8] acpi: Improve some messages level and content Pierre Moreau
2015-05-25 22:22 ` [PATCH 7/8] acpi: Add support for Apple Gmux _DMS Pierre Moreau
     [not found]   ` <1432592573-13743-7-git-send-email-pierre.morrow-GANU6spQydw@public.gmane.org>
2015-05-26  8:13     ` Samuel Pitoiset
     [not found]       ` <55642B45.3020509-Re5JQEeQqe8AvxtiuMwx3w@public.gmane.org>
2015-05-26  8:30         ` Pierre Moreau
2015-05-28  2:58 ` [Nouveau] [PATCH 1/8] acpi: Rename v1 DSM to mux to avoid ambiguity Dave Airlie

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1432592573-13743-1-git-send-email-pierre.morrow@free.fr \
    --to=pierre.morrow@free.fr \
    --cc=bskeggs@redhat.com \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=nouveau@lists.freedesktop.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.