From patchwork Thu Oct 17 08:13:40 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13839607 Received: from mail-pf1-f179.google.com (mail-pf1-f179.google.com [209.85.210.179]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 78B503398B; Thu, 17 Oct 2024 08:14:04 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.210.179 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152846; cv=none; b=DBK+i7IW1IgrIpMpReI0/XOeg7q5n06leH9wYEqSscs6xtEut8rejmrEfNEkpSisr4Ojb22ydaOPfXjIjRJtPARIA+nAEgJUFoWOU7OzgjzWo+r3HeViAqpUTiKX1MBUWmGl1TbOdtwO8BIAcmqjq+7Y1nFt59NAZXa0oN4Rad0= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152846; c=relaxed/simple; bh=RCLv3UmOizm1HJ533JdgCThpkT4GNta9AOVOkmRtWaw=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=Im31izjd0Q1BtDhAOPbfGKx5KCJ+Kv+XlCoCWQwXWDS5JCqpvg5nevWLo8lv6ncawEacF4Qxx+QMHF4OhyQ53qrI2T0NKdStGF4avV1DAyUfYc2qzOysaXC/8dV+4mYdPVmmjZqmkI8noLZG5TEz7WOeCL98LbXVCMFFZgaEwEc= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=F49xVmPr; arc=none smtp.client-ip=209.85.210.179 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="F49xVmPr" Received: by mail-pf1-f179.google.com with SMTP id d2e1a72fcca58-71e61b47c6cso518497b3a.2; Thu, 17 Oct 2024 01:14:04 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729152844; x=1729757644; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=fQibhE7QBP9jlCZ6sIBHC05kDEf4eayahDhz5af+WFc=; b=F49xVmPrHeGJhQOA8NoUeTeLqmOpL6isInF1WOfwtv88V2k4x/BEAnbp1GX9FRMoWv 1YD6bspNyKp9mPrehytfeuyRGTGfr1lJR2xwgRAKo6UzF5WGdSymTz1aIuQ4BmgP8Pwg a97aqiC+wwCOgZrCJk40/yge2x2qS+4V8aq5vTessy9Xv2/whNnlWy9qFc0UJc3rI4vV II/wE6ud1Y78bLh+t38MSsKPIJlhyptgcgpyhqy+O5E3lpdlzzuf8LLwnMtrJltdljLU wl5y5eew5xPaQnwcy2yfnbCm0IZl5zSjF3evcNC+ASaSWblYBZvJjewyRfBIcemV2GLS NJLw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729152844; x=1729757644; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=fQibhE7QBP9jlCZ6sIBHC05kDEf4eayahDhz5af+WFc=; b=ZQyWqp5p24pOqGx/HJRYQTfJp8N9EZbyNaJtRdOugVgW9UQzPejnoLuhHBYxlacUlT eu7hR7r0xBWs8BQAPdCFiS/xo+Y5BiDpfz2LgSp+meMh9dbFcEedUb1wW9RL7Pz6Y1Tw PWKzBDn104ndOPmwW7JOOjeGx3KBpr4UqBMlkKSKweMaqOqBKAxi1SRtBcIP+kv2ij+D 5PqOxMbCdVU7hHMcGni/4k6I8KMqEDYk1ZUKhikrC1MuAr3K0eIdRlFeGWYNV2yQ+Eoy XRrfYqdrXoEJNLzVxmQmJFQghZRShzPPFr5QqtlrA64zsXd2zN/VZKvx5rTIKBRg/brb +vHg== X-Forwarded-Encrypted: i=1; AJvYcCUG8dDzsXY+xKr8BEdiRi8WC17idSIJquNj8GEBNq2XvIay7hhCVxr50rPhhky0Z7IaTrxSQgjQwwTjtHM=@vger.kernel.org, AJvYcCUckqaXr4iOY/r1+Dg40U2rmKC0+C/qjioKFPPH9pu+lbx8dqmxJNJPUfViCh41K3w1KfpFNrkk/QANZ1H5co0q92UVtQ==@vger.kernel.org X-Gm-Message-State: AOJu0Yy7E0sR9nAULTxhxsfSaahFfss+FJmbHSnZlfHzdWoC1P33eET2 dYQkbXIsqEWUBh32mKHe5BACJfIz278a0pYIq/qDphY26Gq1UeCF X-Google-Smtp-Source: AGHT+IGJC2DK5BGTNxPLOqec1CmdazQVkSOplEYGpPaYwdjG7ag3iwzwDmAzi1LcWE7JJfwm5Rr3UQ== X-Received: by 2002:a05:6a00:929e:b0:71e:768b:700a with SMTP id d2e1a72fcca58-71e7db05c3amr11586062b3a.23.1729152843685; Thu, 17 Oct 2024 01:14:03 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e774a41e0sm4227842b3a.134.2024.10.17.01.14.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:14:03 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: W_Armin@gmx.de, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v6 1/5] alienware-wmi: fixed indentation and clean up Date: Thu, 17 Oct 2024 05:13:40 -0300 Message-ID: <20241017081339.126564-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017081211.126214-2-kuurtb@gmail.com> References: <20241017081211.126214-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Fixed inconsistent indentation and removed unnecessary (acpi_size) and (u32 *) casts. Signed-off-by: Kurt Borja Reviewed-by: Armin Wolf --- v6: - Unchanged --- drivers/platform/x86/dell/alienware-wmi.c | 134 +++++++++++----------- 1 file changed, 67 insertions(+), 67 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index f5ee62ce1..16a3fe9ac 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -116,68 +116,68 @@ static int __init dmi_matched(const struct dmi_system_id *dmi) static const struct dmi_system_id alienware_quirks[] __initconst = { { - .callback = dmi_matched, - .ident = "Alienware X51 R3", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"), - }, - .driver_data = &quirk_x51_r3, - }, + .callback = dmi_matched, + .ident = "Alienware X51 R3", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R3"), + }, + .driver_data = &quirk_x51_r3, + }, { - .callback = dmi_matched, - .ident = "Alienware X51 R2", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"), - }, - .driver_data = &quirk_x51_r1_r2, - }, + .callback = dmi_matched, + .ident = "Alienware X51 R2", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51 R2"), + }, + .driver_data = &quirk_x51_r1_r2, + }, { - .callback = dmi_matched, - .ident = "Alienware X51 R1", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"), - }, - .driver_data = &quirk_x51_r1_r2, - }, + .callback = dmi_matched, + .ident = "Alienware X51 R1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware X51"), + }, + .driver_data = &quirk_x51_r1_r2, + }, { - .callback = dmi_matched, - .ident = "Alienware ASM100", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"), - }, - .driver_data = &quirk_asm100, - }, + .callback = dmi_matched, + .ident = "Alienware ASM100", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM100"), + }, + .driver_data = &quirk_asm100, + }, { - .callback = dmi_matched, - .ident = "Alienware ASM200", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM200"), - }, - .driver_data = &quirk_asm200, - }, + .callback = dmi_matched, + .ident = "Alienware ASM200", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM200"), + }, + .driver_data = &quirk_asm200, + }, { - .callback = dmi_matched, - .ident = "Alienware ASM201", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), - DMI_MATCH(DMI_PRODUCT_NAME, "ASM201"), - }, - .driver_data = &quirk_asm201, - }, - { - .callback = dmi_matched, - .ident = "Dell Inc. Inspiron 5675", - .matches = { - DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), - DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"), - }, - .driver_data = &quirk_inspiron5675, - }, + .callback = dmi_matched, + .ident = "Alienware ASM201", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "ASM201"), + }, + .driver_data = &quirk_asm201, + }, + { + .callback = dmi_matched, + .ident = "Dell Inc. Inspiron 5675", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Dell Inc."), + DMI_MATCH(DMI_PRODUCT_NAME, "Inspiron 5675"), + }, + .driver_data = &quirk_inspiron5675, + }, {} }; @@ -221,8 +221,8 @@ static struct platform_zone *zone_data; static struct platform_driver platform_driver = { .driver = { - .name = "alienware-wmi", - } + .name = "alienware-wmi", + } }; static struct attribute_group zone_attribute_group = { @@ -292,7 +292,7 @@ static int alienware_update_led(struct platform_zone *zone) guid = WMAX_CONTROL_GUID; method_id = WMAX_METHOD_ZONE_CONTROL; - input.length = (acpi_size) sizeof(wmax_basic_args); + input.length = sizeof(wmax_basic_args); input.pointer = &wmax_basic_args; } else { legacy_args.colors = zone->colors; @@ -306,7 +306,7 @@ static int alienware_update_led(struct platform_zone *zone) guid = LEGACY_CONTROL_GUID; method_id = zone->location + 1; - input.length = (acpi_size) sizeof(legacy_args); + input.length = sizeof(legacy_args); input.pointer = &legacy_args; } pr_debug("alienware-wmi: guid %s method %d\n", guid, method_id); @@ -358,7 +358,7 @@ static int wmax_brightness(int brightness) .led_mask = 0xFF, .percentage = brightness, }; - input.length = (acpi_size) sizeof(args); + input.length = sizeof(args); input.pointer = &args; status = wmi_evaluate_method(WMAX_CONTROL_GUID, 0, WMAX_METHOD_BRIGHTNESS, &input, NULL); @@ -508,7 +508,7 @@ static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, struct acpi_buffer input; struct acpi_buffer output; - input.length = (acpi_size) sizeof(*in_args); + input.length = sizeof(*in_args); input.pointer = in_args; if (out_data) { output.length = ACPI_ALLOCATE_BUFFER; @@ -542,7 +542,7 @@ static ssize_t show_hdmi_cable(struct device *dev, }; status = alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_CABLE, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -563,7 +563,7 @@ static ssize_t show_hdmi_source(struct device *dev, }; status = alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_STATUS, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 1) @@ -643,7 +643,7 @@ static ssize_t show_amplifier_status(struct device *dev, }; status = alienware_wmax_command(&in_args, WMAX_METHOD_AMPLIFIER_CABLE, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -695,7 +695,7 @@ static ssize_t show_deepsleep_status(struct device *dev, .arg = 0, }; status = alienware_wmax_command(&in_args, WMAX_METHOD_DEEP_SLEEP_STATUS, - (u32 *) &out_data); + &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); From patchwork Thu Oct 17 08:14:56 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13839608 Received: from mail-pl1-f169.google.com (mail-pl1-f169.google.com [209.85.214.169]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 13A1C1CACF7; Thu, 17 Oct 2024 08:15:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.169 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152908; cv=none; b=lCQuoslFB4Zn3Vz+MqqklmF+U28Q4XRcsYeMIftPlUJQ7AevN/o63oiwpjUoOZUWnMhDaNcATee3VQBINsfC76/KpCkGHS5UlKl+muNXYZetD7lU+/Lqq9zSqat/eNS725or02jqArI2IWbsl3H9zcXlfiQEZzbeEx6g2EowuJI= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152908; c=relaxed/simple; bh=mYMb+Dc1qChnZr0nDmHM4chsYqQB6NpUd6IUpmlG7II=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=quhI2L1giGLBjU25sC4B2ZUDsN2FhLJTlLH0u+gyfHw5X3jBZQCvVgotSnSC3Cve7viMPUtaq+dZ7ol0oYxWzG4b/72GxTwIrPAc+/DP9oLPmlCnDJUefD7Rt7ZZY9Rr9SMvWeNbp/psJCLx/wy5GWGqkVTtVSBKJHIs/g5tul8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=DUNcro5t; arc=none smtp.client-ip=209.85.214.169 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="DUNcro5t" Received: by mail-pl1-f169.google.com with SMTP id d9443c01a7336-20c714cd9c8so6939025ad.0; Thu, 17 Oct 2024 01:15:06 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729152906; x=1729757706; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=cLs1+OzWOMNuwsLpxLLXfGBTRAT71kxhFdirRPYIdb0=; b=DUNcro5twnlTiTUOhKnId+Hlaa0VD9m7mDKeEf2QamIQODkStPnSNWLZNHCdRybIlF 5IT3+v5cTe+ZzPDe5oAC+x0gkH6BJJD8fIa/xstv/TBhXxWS5tmWkps5l4n5IIFOjVez Wg4Mr5RExdODDdZjUNPhb2tuHScovl+w+jNG0Ix2g/+7GzE5RgEdTwO7/2CvAD/uDg0v JeFahAqY/up9kIIrbykrHZf5UNEyevMJIXB/UqFB85X98JVJAqXhd95otrPl9q/nQg0c q9AeOM3vl+cXehXefuzd0yu+VhV5VBMhA6GqqF8E/ifAWlNomltdyYS6uj0sDCRtiETr w1Ng== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729152906; x=1729757706; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=cLs1+OzWOMNuwsLpxLLXfGBTRAT71kxhFdirRPYIdb0=; b=a0PCWfubtwXpboOS8CvKAN3wbadZHnXa6buqU4L0MNUBxE5Yq/QRcxh1lKAt5t7SMR lvyl/s1B2/nq5af/7zneFicgAywU99qly9/3pkN4XEmnqDh0Rk97Hw2lCaqMxCN4ymkB yH4KIE09L+Idy6CD3edytt3O+oCm3NQHWmqNRrDkRL/MO6CiifWFPDb3vR5oupMmnTcG grLGgNhwQcC+7s8xFOAg5LM5luV9bssSybMWo+c9FU+WA5VQ+w1XH10A4J/DWr72usoV 6va9NmxTpmQ5CWewrWfC5MyLIJQwyQrvVwvt7u2h2wqu2NdM0ezzsbaVnYTvN4r5LCMO f3Lg== X-Forwarded-Encrypted: i=1; AJvYcCUH4MFe2PeLWbAUmhvVjgT6dCPI/EriLcgZD2cpDtZVR9m2E3lfuGVMDBD05T0eCwDCG+Qih8M1sCd4RNs=@vger.kernel.org, AJvYcCVWECt9FIuSkiiN8CvlL/yG2Y1MY6kMXM+xgDvb3Bf/kHMUdOvGGNAL6EFHelAyNqgwNjxnOrNctctmO1I51Pp3Nhv3mw==@vger.kernel.org X-Gm-Message-State: AOJu0Yy7hR1WyWgxfEkj8KdsXyzN/WPWdTn0JtZe9zsf3RAzbMkd4i+Q gigS4Hy87bFquEhdp78puXME5gjfEtogHSqjN13aFvw/b+uiFarb X-Google-Smtp-Source: AGHT+IE/tHURsU2I/Al5EytdiTI0MnRM3s6JI87zcZbi/y6ntxfyYEaEBYuUyS/mmYi7cEh2soP10A== X-Received: by 2002:a17:902:e80d:b0:20c:7d7d:7ba8 with SMTP id d9443c01a7336-20cbb22f1e8mr259098335ad.46.1729152906298; Thu, 17 Oct 2024 01:15:06 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20d1804b2e4sm39871665ad.182.2024.10.17.01.15.04 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:15:06 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: W_Armin@gmx.de, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v6 2/5] alienware-wmi: alienware_wmax_command() is now input size agnostic Date: Thu, 17 Oct 2024 05:14:56 -0300 Message-ID: <20241017081455.126851-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017081211.126214-2-kuurtb@gmail.com> References: <20241017081211.126214-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 alienware_wmax_command() now takes void * and size_t instead of struct wmax_basic_args to extend support to new WMAX methods. Also int *out_data was changed to u32 *out_data, because new interface specifies u32 as output parameter and all previous callers would pass u32 * regardless. Signed-off-by: Kurt Borja Reviewed-by: Armin Wolf --- v6: - Unchanged --- drivers/platform/x86/dell/alienware-wmi.c | 29 ++++++++++++----------- 1 file changed, 15 insertions(+), 14 deletions(-) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 16a3fe9ac..b27f3b64c 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -500,15 +500,15 @@ static void alienware_zone_exit(struct platform_device *dev) kfree(zone_attrs); } -static acpi_status alienware_wmax_command(struct wmax_basic_args *in_args, - u32 command, int *out_data) +static acpi_status alienware_wmax_command(void *in_args, size_t in_size, + u32 command, u32 *out_data) { acpi_status status; union acpi_object *obj; struct acpi_buffer input; struct acpi_buffer output; - input.length = sizeof(*in_args); + input.length = in_size; input.pointer = in_args; if (out_data) { output.length = ACPI_ALLOCATE_BUFFER; @@ -541,8 +541,8 @@ static ssize_t show_hdmi_cable(struct device *dev, .arg = 0, }; status = - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_CABLE, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_HDMI_CABLE, &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -562,8 +562,8 @@ static ssize_t show_hdmi_source(struct device *dev, .arg = 0, }; status = - alienware_wmax_command(&in_args, WMAX_METHOD_HDMI_STATUS, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_HDMI_STATUS, &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 1) @@ -589,7 +589,8 @@ static ssize_t toggle_hdmi_source(struct device *dev, args.arg = 3; pr_debug("alienware-wmi: setting hdmi to %d : %s", args.arg, buf); - status = alienware_wmax_command(&args, WMAX_METHOD_HDMI_SOURCE, NULL); + status = alienware_wmax_command(&args, sizeof(args), + WMAX_METHOD_HDMI_SOURCE, NULL); if (ACPI_FAILURE(status)) pr_err("alienware-wmi: HDMI toggle failed: results: %u\n", @@ -642,8 +643,8 @@ static ssize_t show_amplifier_status(struct device *dev, .arg = 0, }; status = - alienware_wmax_command(&in_args, WMAX_METHOD_AMPLIFIER_CABLE, - &out_data); + alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_AMPLIFIER_CABLE, &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[unconnected] connected unknown\n"); @@ -694,8 +695,8 @@ static ssize_t show_deepsleep_status(struct device *dev, struct wmax_basic_args in_args = { .arg = 0, }; - status = alienware_wmax_command(&in_args, WMAX_METHOD_DEEP_SLEEP_STATUS, - &out_data); + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_DEEP_SLEEP_STATUS, &out_data); if (ACPI_SUCCESS(status)) { if (out_data == 0) return sysfs_emit(buf, "[disabled] s5 s5_s4\n"); @@ -723,8 +724,8 @@ static ssize_t toggle_deepsleep(struct device *dev, args.arg = 2; pr_debug("alienware-wmi: setting deep sleep to %d : %s", args.arg, buf); - status = alienware_wmax_command(&args, WMAX_METHOD_DEEP_SLEEP_CONTROL, - NULL); + status = alienware_wmax_command(&args, sizeof(args), + WMAX_METHOD_DEEP_SLEEP_CONTROL, NULL); if (ACPI_FAILURE(status)) pr_err("alienware-wmi: deep sleep control failed: results: %u\n", From patchwork Thu Oct 17 08:15:25 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13839609 Received: from mail-pj1-f43.google.com (mail-pj1-f43.google.com [209.85.216.43]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 420C53398B; Thu, 17 Oct 2024 08:16:22 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.216.43 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152984; cv=none; b=iOU9jSrDDUAS+k7OZ04AG3UhVmhjoYHzBHp5MoGWs3A9hWnyp9He0v138N5DHQJQRau6M1L+Jo8dujF9CpxrZbEytw7g8NvxPrQOqBhH47M64gq0jvOF2i3GZ4O6H/3RPZgd/ZSbE3qvKMfI6/mYFUzOtOuziIF4mtJUFzjLsJA= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729152984; c=relaxed/simple; bh=BtWW25QWspbdzM9WoYRYC7Dp2CEImLAiYf2AQzWDhnU=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=nA6qj2+ouFl7MEmjqbDf5yqIDPkOp+YnQIScKgfZnkXO3oRW2J5GJBzaI0hUvRV5jd4Jrrl2ABX96BoRQtZHnMjPItg7WsEOO4uDY1dD/zV4LuY1rpEGWPNttUiBES7dNm6WYToJ5QpAvEiNUCSarr0f+b1viGuK24wLTTkw4gw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=nMV5XMHg; arc=none smtp.client-ip=209.85.216.43 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="nMV5XMHg" Received: by mail-pj1-f43.google.com with SMTP id 98e67ed59e1d1-2e2e88cb0bbso470942a91.3; Thu, 17 Oct 2024 01:16:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729152981; x=1729757781; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=QJKKWSJtGTH+Zha/IDGEo1+HvKzQHeVOpKBCtqcEBl8=; b=nMV5XMHgzEBPTGCy5EelFgbQ+6np1mVFEz8wOgoL3ygFL15m3hM5ua09pobN3d3Laz 1Ldojdxyeyt393TbpIecxENonL6HOdi9blGAnjph1GN8rKAfm8daPlE6idTC116u0T4f P+F/un78lgXQzvnERDqOq/ecH6bWZgcDb69PJViABDuA4XyBEbcz6UvlUJoX6bckzphG fu10q4T79GKgRwolPa48yc1Yis+AL6lOTmBgGBNvQm9cg/wf9Sz3ZPx3C0qlRixcLfaY mOe6EvLNb+auITreI7l2kdsNpcao9WbZXtIzP+jGWfHl7Cwv83INJkkEXL1qp16ARlyf SBaQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729152981; x=1729757781; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=QJKKWSJtGTH+Zha/IDGEo1+HvKzQHeVOpKBCtqcEBl8=; b=laisn4sfoZZtZIyFmxIgzczf/IOA1GCXYcpgqUDXtQgxzmkmCfbpey7h4Cac3uzPGv uvMfcYYJrUXIfJcaVh3rnqXKq35sfbLzv6ws9XP6g4mdeeJUPsUaWn/nlPkMVcKhiVtB DulWgd0ttCbomiNEgtgYhlzfNgcTbod7eQDUnrmkkGsj8T66/nnGMlQbWmrwJ3Qb/1X7 +tTAHq3UTrOEPv+wT6M2kzRF17335VjPtHbVd7aLjvQS8Ixgid3hZkyi2z2ImA03GRwG rFqwcKYnSKepiTIgKlZVthwdM2EoX5XEfEJj4ETxTzaQpwfXfx0lh1VvqOvmi6sAdOtm 0tKw== X-Forwarded-Encrypted: i=1; AJvYcCU/NMKvZ3wYYMYvRoY7z6eVa8so/dYstH4O1wTHG60aF53nQv6BNEYRg7V6TVqHmN33tApSJrBa2kOt8n0=@vger.kernel.org, AJvYcCXL3ecF18Vwxt4XCxjNov4wsnJx4ny+011Fh5dRcTTz2Rn2rZBUm/fi+Ivur1wExHpsH4qudIdvIZYHrrS+RW0mD+ws/g==@vger.kernel.org X-Gm-Message-State: AOJu0YyokvVp1yomt/QTfSgVIzVNyBFAXbLgxmHJV3LXD8N0LmZTm6/i dTNo3tjKWgGHmUO4pq2gpONq6xV3gWNDPqqpKphkQvieeIxe19Xh X-Google-Smtp-Source: AGHT+IGFpQ2iaN29rVbnMub9g2VbmqhDYvwsIoN3G5G0JqMVk4/fJHHnoTqBd0nTQIw+e+ObmRVdfg== X-Received: by 2002:a17:90b:4c02:b0:2e2:bd4b:ac2c with SMTP id 98e67ed59e1d1-2e3ab8bcef5mr8325482a91.31.1729152981500; Thu, 17 Oct 2024 01:16:21 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id 98e67ed59e1d1-2e3e08f9913sm1343963a91.44.2024.10.17.01.16.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:16:21 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: W_Armin@gmx.de, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v6 3/5] alienware-wmi: added platform profile support Date: Thu, 17 Oct 2024 05:15:25 -0300 Message-ID: <20241017081524.127072-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017081211.126214-2-kuurtb@gmail.com> References: <20241017081211.126214-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Implements platform profile support for Dell laptops with new WMAX thermal interface, present on some Alienware X-Series, Alienware M-Series and Dell's G-Series laptops. This implementation supports three sets of thermal tables declared in enum WMAX_THERMAL_TABLE and gmode, using quirks *thermal* and *gmode* respectively. These sets are found in most Dell's devices that support WMAX's thermal interface. Signed-off-by: Kurt Borja Reviewed-by: Armin Wolf --- v6: - Fixed alignment on some function definitions - Fixed braces on if statment - Removed quirk thermal_ustt - Now quirk thermal can take values defined in enum WMAX_THERMAL_TABLE. - Proper removal of thermal_profile --- drivers/platform/x86/dell/Kconfig | 1 + drivers/platform/x86/dell/alienware-wmi.c | 251 ++++++++++++++++++++++ 2 files changed, 252 insertions(+) diff --git a/drivers/platform/x86/dell/Kconfig b/drivers/platform/x86/dell/Kconfig index 68a49788a..b06d634cd 100644 --- a/drivers/platform/x86/dell/Kconfig +++ b/drivers/platform/x86/dell/Kconfig @@ -21,6 +21,7 @@ config ALIENWARE_WMI depends on LEDS_CLASS depends on NEW_LEDS depends on ACPI_WMI + select ACPI_PLATFORM_PROFILE help This is a driver for controlling Alienware BIOS driven features. It exposes an interface for controlling the AlienFX diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index b27f3b64c..37a898273 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -8,8 +8,11 @@ #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt #include +#include +#include #include #include +#include #include #include @@ -25,6 +28,12 @@ #define WMAX_METHOD_AMPLIFIER_CABLE 0x6 #define WMAX_METHOD_DEEP_SLEEP_CONTROL 0x0B #define WMAX_METHOD_DEEP_SLEEP_STATUS 0x0C +#define WMAX_METHOD_THERMAL_INFORMATION 0x14 +#define WMAX_METHOD_THERMAL_CONTROL 0x15 + +#define WMAX_ARG_GET_CURRENT_PROF 0x0B + +#define WMAX_FAILURE_CODE 0xFFFFFFFF MODULE_AUTHOR("Mario Limonciello "); MODULE_DESCRIPTION("Alienware special feature control"); @@ -49,11 +58,33 @@ enum WMAX_CONTROL_STATES { WMAX_SUSPEND = 3, }; +enum WMAX_THERMAL_TABLE { + WMAX_THERMAL_TABLE_SIMPLE = 1, + WMAX_THERMAL_TABLE_USTT = 2, + WMAX_THERMAL_TABLE_USTT_COOL = 3, +}; + +enum WMAX_THERMAL_PROFILE { + WMAX_THERMAL_QUIET = 0x96, + WMAX_THERMAL_BALANCED = 0x97, + WMAX_THERMAL_BALANCED_PERFORMANCE = 0x98, + WMAX_THERMAL_PERFORMANCE = 0x99, + WMAX_THERMAL_USTT_LOW_POWER = 0xA5, + WMAX_THERMAL_USTT_COOL = 0xA2, + WMAX_THERMAL_USTT_QUIET = 0xA3, + WMAX_THERMAL_USTT_BALANCED = 0xA0, + WMAX_THERMAL_USTT_BALANCED_PERFORMANCE = 0xA1, + WMAX_THERMAL_USTT_PERFORMANCE = 0xA4, + WMAX_THERMAL_GMODE = 0xAB, +}; + struct quirk_entry { u8 num_zones; u8 hdmi_mux; u8 amplifier; u8 deepslp; + u8 thermal; + u8 gmode; }; static struct quirk_entry *quirks; @@ -64,6 +95,8 @@ static struct quirk_entry quirk_inspiron5675 = { .hdmi_mux = 0, .amplifier = 0, .deepslp = 0, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_unknown = { @@ -71,6 +104,8 @@ static struct quirk_entry quirk_unknown = { .hdmi_mux = 0, .amplifier = 0, .deepslp = 0, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_x51_r1_r2 = { @@ -78,6 +113,8 @@ static struct quirk_entry quirk_x51_r1_r2 = { .hdmi_mux = 0, .amplifier = 0, .deepslp = 0, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_x51_r3 = { @@ -85,6 +122,8 @@ static struct quirk_entry quirk_x51_r3 = { .hdmi_mux = 0, .amplifier = 1, .deepslp = 0, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_asm100 = { @@ -92,6 +131,8 @@ static struct quirk_entry quirk_asm100 = { .hdmi_mux = 1, .amplifier = 0, .deepslp = 0, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_asm200 = { @@ -99,6 +140,8 @@ static struct quirk_entry quirk_asm200 = { .hdmi_mux = 1, .amplifier = 0, .deepslp = 1, + .thermal = 0, + .gmode = 0, }; static struct quirk_entry quirk_asm201 = { @@ -106,6 +149,17 @@ static struct quirk_entry quirk_asm201 = { .hdmi_mux = 1, .amplifier = 1, .deepslp = 1, + .thermal = 0, + .gmode = 0, +}; + +static struct quirk_entry quirk_x15_r1 = { + .num_zones = 2, + .hdmi_mux = 0, + .amplifier = 0, + .deepslp = 0, + .thermal = WMAX_THERMAL_TABLE_USTT, + .gmode = 0, }; static int __init dmi_matched(const struct dmi_system_id *dmi) @@ -169,6 +223,15 @@ static const struct dmi_system_id alienware_quirks[] __initconst = { }, .driver_data = &quirk_asm201, }, + { + .callback = dmi_matched, + .ident = "Alienware x15 R1", + .matches = { + DMI_MATCH(DMI_SYS_VENDOR, "Alienware"), + DMI_MATCH(DMI_PRODUCT_NAME, "Alienware x15 R1") + }, + .driver_data = &quirk_x15_r1, + }, { .callback = dmi_matched, .ident = "Dell Inc. Inspiron 5675", @@ -218,6 +281,7 @@ static struct platform_device *platform_device; static struct device_attribute *zone_dev_attrs; static struct attribute **zone_attrs; static struct platform_zone *zone_data; +static struct platform_profile_handler pp_handler; static struct platform_driver platform_driver = { .driver = { @@ -761,6 +825,184 @@ static int create_deepsleep(struct platform_device *dev) return ret; } +/* + * Thermal Profile control + * - Provides thermal profile control through the Platform Profile API + */ +#define WMAX_ARGUMENT_MASK GENMASK(15, 8) +#define WMAX_PROFILE_ACTIVATE 0x01 + +static u32 profile_to_wmax_arg(enum WMAX_THERMAL_PROFILE prof) +{ + return FIELD_PREP(WMAX_ARGUMENT_MASK, prof) | WMAX_PROFILE_ACTIVATE; +} + +static int thermal_profile_get(struct platform_profile_handler *pprof, + enum platform_profile_option *profile) +{ + acpi_status status; + u32 in_args = WMAX_ARG_GET_CURRENT_PROF; + u32 out_data; + + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_INFORMATION, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data == WMAX_FAILURE_CODE) + return -EBADRQC; + + switch (out_data) { + case WMAX_THERMAL_USTT_LOW_POWER: + *profile = PLATFORM_PROFILE_LOW_POWER; + break; + case WMAX_THERMAL_USTT_COOL: + *profile = PLATFORM_PROFILE_COOL; + break; + case WMAX_THERMAL_QUIET: + case WMAX_THERMAL_USTT_QUIET: + *profile = PLATFORM_PROFILE_QUIET; + break; + case WMAX_THERMAL_BALANCED: + case WMAX_THERMAL_USTT_BALANCED: + *profile = PLATFORM_PROFILE_BALANCED; + break; + case WMAX_THERMAL_BALANCED_PERFORMANCE: + case WMAX_THERMAL_USTT_BALANCED_PERFORMANCE: + *profile = PLATFORM_PROFILE_BALANCED_PERFORMANCE; + break; + case WMAX_THERMAL_GMODE: + case WMAX_THERMAL_PERFORMANCE: + case WMAX_THERMAL_USTT_PERFORMANCE: + *profile = PLATFORM_PROFILE_PERFORMANCE; + break; + default: + return -ENODATA; + } + + return 0; +} + +static int thermal_profile_set(struct platform_profile_handler *pprof, + enum platform_profile_option profile) +{ + acpi_status status; + u32 in_args; + u32 out_data; + + switch (profile) { + case PLATFORM_PROFILE_QUIET: + in_args = profile_to_wmax_arg(WMAX_THERMAL_QUIET); + break; + case PLATFORM_PROFILE_BALANCED: + in_args = profile_to_wmax_arg(WMAX_THERMAL_BALANCED); + break; + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + in_args = profile_to_wmax_arg(WMAX_THERMAL_BALANCED_PERFORMANCE); + break; + case PLATFORM_PROFILE_PERFORMANCE: + if (quirks->gmode > 0) + in_args = profile_to_wmax_arg(WMAX_THERMAL_GMODE); + else + in_args = profile_to_wmax_arg(WMAX_THERMAL_PERFORMANCE); + break; + default: + return -EOPNOTSUPP; + } + + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_CONTROL, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data == WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int thermal_profile_set_ustt(struct platform_profile_handler *pprof, + enum platform_profile_option profile) +{ + acpi_status status; + u32 in_args; + u32 out_data; + + switch (profile) { + case PLATFORM_PROFILE_LOW_POWER: + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_LOW_POWER); + break; + case PLATFORM_PROFILE_COOL: + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_COOL); + break; + case PLATFORM_PROFILE_QUIET: + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_QUIET); + break; + case PLATFORM_PROFILE_BALANCED: + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_BALANCED); + break; + case PLATFORM_PROFILE_BALANCED_PERFORMANCE: + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_BALANCED_PERFORMANCE); + break; + case PLATFORM_PROFILE_PERFORMANCE: + if (quirks->gmode > 0) + in_args = profile_to_wmax_arg(WMAX_THERMAL_GMODE); + else + in_args = profile_to_wmax_arg(WMAX_THERMAL_USTT_PERFORMANCE); + break; + default: + return -EOPNOTSUPP; + } + + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_CONTROL, &out_data); + + if (ACPI_FAILURE(status)) + return -EIO; + + if (out_data == WMAX_FAILURE_CODE) + return -EBADRQC; + + return 0; +} + +static int create_thermal_profile(void) +{ + pp_handler.profile_get = thermal_profile_get; + + switch (quirks->thermal) { + case WMAX_THERMAL_TABLE_SIMPLE: + pp_handler.profile_set = thermal_profile_set; + break; + case WMAX_THERMAL_TABLE_USTT: + pp_handler.profile_set = thermal_profile_set_ustt; + set_bit(PLATFORM_PROFILE_LOW_POWER, pp_handler.choices); + set_bit(PLATFORM_PROFILE_QUIET, pp_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pp_handler.choices); + break; + case WMAX_THERMAL_TABLE_USTT_COOL: + pp_handler.profile_set = thermal_profile_set_ustt; + set_bit(PLATFORM_PROFILE_LOW_POWER, pp_handler.choices); + set_bit(PLATFORM_PROFILE_QUIET, pp_handler.choices); + set_bit(PLATFORM_PROFILE_COOL, pp_handler.choices); + set_bit(PLATFORM_PROFILE_BALANCED_PERFORMANCE, pp_handler.choices); + break; + } + + set_bit(PLATFORM_PROFILE_BALANCED, pp_handler.choices); + set_bit(PLATFORM_PROFILE_PERFORMANCE, pp_handler.choices); + + return platform_profile_register(&pp_handler); +} + +static void remove_thermal_profile(void) +{ + if (quirks->thermal > 0) + platform_profile_remove(); +} + static int __init alienware_wmi_init(void) { int ret; @@ -808,6 +1050,12 @@ static int __init alienware_wmi_init(void) goto fail_prep_deepsleep; } + if (quirks->thermal > 0) { + ret = create_thermal_profile(); + if (ret) + goto fail_prep_thermal_profile; + } + ret = alienware_zone_init(platform_device); if (ret) goto fail_prep_zones; @@ -816,6 +1064,8 @@ static int __init alienware_wmi_init(void) fail_prep_zones: alienware_zone_exit(platform_device); + remove_thermal_profile(); +fail_prep_thermal_profile: fail_prep_deepsleep: fail_prep_amplifier: fail_prep_hdmi: @@ -835,6 +1085,7 @@ static void __exit alienware_wmi_exit(void) if (platform_device) { alienware_zone_exit(platform_device); remove_hdmi(platform_device); + remove_thermal_profile(); platform_device_unregister(platform_device); platform_driver_unregister(&platform_driver); } From patchwork Thu Oct 17 08:16:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13839610 Received: from mail-pl1-f176.google.com (mail-pl1-f176.google.com [209.85.214.176]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id BE1F01C3F1C; Thu, 17 Oct 2024 08:16:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.214.176 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729153011; cv=none; b=LOdmjWfa20elUf4S3IyR3qt6EnVYZuuqkMoMmHMokqH76/aTbQeNAkFoCGJMfVYxEktq2tdhs7N3HJr/8DE8+tIpKSEV1JBMcNYEds1+Ga8ivJYBZjXSfy+FElWHtMBqVBjbpxNml9uMHUF3ogwgReXXHeevCxUjNdeua2rk4yo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729153011; c=relaxed/simple; bh=d90PHQSeAh3+rIYCUoOl/q337T76O+cbg+e6ybgRxeM=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=sTU4uD2gQD4xvN0RFMb5YyziurdJTRpMwoenPfcYCbv+DNW1uqsBB/vgAG4JamPt3uFF7PeB84LxKvcfHzNqfOe2KZdwPyCO5kadLS/4+IKLTj/dKoWK1ShbBb7zB87KVRj8hI4jPhlBbFv5YokFtgsyREIsU6NgMsCCXLsR1uw= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Lhyulja4; arc=none smtp.client-ip=209.85.214.176 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Lhyulja4" Received: by mail-pl1-f176.google.com with SMTP id d9443c01a7336-20cbca51687so7246275ad.1; Thu, 17 Oct 2024 01:16:49 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729153009; x=1729757809; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=9Bm4jnKa4F9F0RZdsYRUP1p+4Ch47WjbmZE4eaTvz4k=; b=Lhyulja42kpwNY0aREKYAttQmUN57/R94AyeAq+QxhPc14lZkskI8Rv6Lp8vHevlB7 STnSVX/Ntx4T13QRlEQMe8PljUsv5gsi78S7Z51Zmwc8hzgVu1LzC+nJF1G66sSro0ZH tfpvYTe9rP4+tKZc3+JBDyfRtN7EL+d67vSoJUzcAKcfTGlQMPDlEUTEnDoOVQowu0C1 d2+sBgdUQaTJ7uX3TqJ9iWPFs3gB3Yot8UTQeUnT9HXUoYNg7MBK2SWhenqNEXlWRcI7 n4YRfd7MI1FTObl3+yI87TPHKR+/WYB9QKK2F5jfmrVJoFlQbWcyh4Vza+RNdA6wz8qq 8L/A== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729153009; x=1729757809; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=9Bm4jnKa4F9F0RZdsYRUP1p+4Ch47WjbmZE4eaTvz4k=; b=n+CL8DZ8zbPm6xESDFWpUnIAqwVlA4yCKeat/CeAIBFW6/hW9lwUuuFyn2BjUE5JYq ypXHxXOR9RCWnuE2pUJduUFgZqB6P/s5RViw3zKX7G3NzpuFGKmaZIXkswdyGVqgeadc KGgHPNpSH3gFBrS4HremJFms8JcA9JDZp+u6pSjYTmUo0zdxA4yn2qT06id2yGp6VT6C ek8eyM1AIz3u4CyAqhdLDX0GtlmeLmXdzAnwpGJQc9YhI6co20NqXr7XIu7g2zAO+7r9 lVszu/ILXD8z97Qfw3RTO8z1B11qrxBql+HRw7NORiGwhCyXl2WE7E99hY73ebKWJItN CgsA== X-Forwarded-Encrypted: i=1; AJvYcCWHRuqZFFxoc5rRn6YDBShCl2i8MQX2DSrAi+Fw6Q1E0pd6+vUjAYjTpAlWhj+oH0jc3pVOl51qg2COB5o=@vger.kernel.org, AJvYcCWUawUzD0uZ9f38T/z5OsFxq3vuFTSmhZRm/i2X59bV29vEHLuOlTN3l+atwxTT/asNCmF0/WT7Q8stO/UsDN5AEFbNyQ==@vger.kernel.org X-Gm-Message-State: AOJu0YwZ7gHxFmMSkJqlsXZYCEmJ3WWEEiP4hbWZnQokkoeG+g+HA89C QCG+3iTgyaNFVLZQeaNOxj0KrOFoZAmG0BkiY+CWKAHf19Rcaedt X-Google-Smtp-Source: AGHT+IHhRobSHaH53eJJuZZCL2A+Cv/16jd21ueCB3B5xPAkX1wy2enBiGkK5Ap/kB0Tf/GbqoMeog== X-Received: by 2002:a17:902:ce87:b0:20c:8b10:9660 with SMTP id d9443c01a7336-20cbb2845dcmr299010205ad.44.1729153008847; Thu, 17 Oct 2024 01:16:48 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d9443c01a7336-20d17f9d419sm39816725ad.93.2024.10.17.01.16.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:16:48 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: W_Armin@gmx.de, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v6 4/5] alienware-wmi: added autodetect_thermal_profile for devices with quirk_unknown Date: Thu, 17 Oct 2024 05:16:33 -0300 Message-ID: <20241017081631.127333-3-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017081211.126214-2-kuurtb@gmail.com> References: <20241017081211.126214-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Added autodetect_thermal_profile for devices with quirk_unknown. Autodetection is done through basic conditions most devices with WMAX's thermal interface meet. Function exits returning 0 in case of errors. Signed-off-by: Kurt Borja Reviewed-by: Armin Wolf --- I apologize for the late inclusion. This feature can extend support to many devices without having to list them in alienware_quirks. The conditions for selecting the automatic thermal profile are based on observations on a lot of *issues* in AWCC open source alternatives. I observed only Dell's G-Series laptops have WMAX_THERMAL_BALANCED avaliable and when it's present none of the other profiles are avaliable, except for GMODE. When a model has USTT profiles avaliable usually they have all USTT profiles avaliable, except for cool on mostly Alienware devices. I made another implementation of this function, brute-forcing operation 0x03 of Thermal_Information, which is the operation that varies the most across models. I found the implementation too cumbersome to include in this series, but it could potentially extend support of this driver to all posible devices with this interface automatically. Another possibility is just including every device I observed into alienware_quirks, which I can do but I want to know your opinion first. --- drivers/platform/x86/dell/alienware-wmi.c | 42 +++++++++++++++++++++++ 1 file changed, 42 insertions(+) diff --git a/drivers/platform/x86/dell/alienware-wmi.c b/drivers/platform/x86/dell/alienware-wmi.c index 37a898273..a11ff4851 100644 --- a/drivers/platform/x86/dell/alienware-wmi.c +++ b/drivers/platform/x86/dell/alienware-wmi.c @@ -30,8 +30,11 @@ #define WMAX_METHOD_DEEP_SLEEP_STATUS 0x0C #define WMAX_METHOD_THERMAL_INFORMATION 0x14 #define WMAX_METHOD_THERMAL_CONTROL 0x15 +#define WMAX_METHOD_GMODE_STATUS 0x25 +#define WMAX_ARG_GET_DEFAULT_PROF 0x0A #define WMAX_ARG_GET_CURRENT_PROF 0x0B +#define WMAX_ARG_GET_GMODE_STATUS 0x02 #define WMAX_FAILURE_CODE 0xFFFFFFFF @@ -968,6 +971,42 @@ static int thermal_profile_set_ustt(struct platform_profile_handler *pprof, return 0; } +static int autodetect_thermal_profile(void) +{ + acpi_status status; + u32 in_args; + u32 default_profile; + u32 gmode; + + in_args = WMAX_ARG_GET_DEFAULT_PROF; + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_THERMAL_INFORMATION, &default_profile); + + if (ACPI_FAILURE(status)) + return 0; + + in_args = WMAX_ARG_GET_GMODE_STATUS; + status = alienware_wmax_command(&in_args, sizeof(in_args), + WMAX_METHOD_GMODE_STATUS, &gmode); + + if (ACPI_FAILURE(status)) + return 0; + + if (default_profile == WMAX_THERMAL_BALANCED && gmode == 1) { + quirks->thermal = WMAX_THERMAL_TABLE_SIMPLE; + quirks->gmode = 1; + return 0; + } + + if (default_profile == WMAX_THERMAL_USTT_BALANCED) + quirks->thermal = WMAX_THERMAL_TABLE_USTT; + + if (gmode == 0 || gmode == 1) + quirks->gmode = 1; + + return 0; +} + static int create_thermal_profile(void) { pp_handler.profile_get = thermal_profile_get; @@ -1050,6 +1089,9 @@ static int __init alienware_wmi_init(void) goto fail_prep_deepsleep; } + if (interface == WMAX && quirks == &quirk_unknown) + autodetect_thermal_profile(); + if (quirks->thermal > 0) { ret = create_thermal_profile(); if (ret) From patchwork Thu Oct 17 08:17:09 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Kurt Borja X-Patchwork-Id: 13839611 Received: from mail-pg1-f174.google.com (mail-pg1-f174.google.com [209.85.215.174]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 8DD2842AB1; Thu, 17 Oct 2024 08:17:19 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.174 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729153042; cv=none; b=uqvv/Jts9yRdaPhKomAPmka9qXticG8y4yOEmu6crv1yHuKLTrAX2F7DODeo8ZMR1xL1NljkX2HeJcshTcDIheZsQu+fembUBYv0GGu3n53Zu6JXI28BOgZqyUaBORzpfQsZcZwOTzgzVnHA8YOK8Z0Sr52RHbk/KrMjkyLHpiw= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1729153042; c=relaxed/simple; bh=toj5jT/N43JlUeUV49TzLbhT9WkKYYQ6zNyxOu2SUN4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=fMNlbeN4n1dkgGf4KyZ+jQxJlwCU1AESwi7hx50yux/KQ9N42TDmELBLevbqeLn5bjEdfOLpJC00OqUc7Ara8K7N/iLy8tQPm70YKCB5jm4smBG5Y/PKnucI1RNMShssmqmiIXmu5hc3bdjJgqfTk9P4Lc8ze57eHqdX1b4VZjA= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=Or2Kt0md; arc=none smtp.client-ip=209.85.215.174 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="Or2Kt0md" Received: by mail-pg1-f174.google.com with SMTP id 41be03b00d2f7-7ea6a4f287bso451607a12.3; Thu, 17 Oct 2024 01:17:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20230601; t=1729153039; x=1729757839; darn=vger.kernel.org; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:from:to:cc:subject:date :message-id:reply-to; bh=vg7vd+fy/VzhW4y6/SWqvLzT/0RiOVGsypfe5+UKm/0=; b=Or2Kt0mdZJWMPgfpchfd3q9Je/3djCsKbOnlpzG5xJ++x0cWFKqqrUlOkBee3yKlwb eOL78oMPcCe57B7QWD6TOeTmFh+G15qE4k08BRq+JT8t9+DRLBJ+hS3VjUAG8omdkZc3 E5xCUtKV6IzVR73dWACrEnXAxSbAmVwBGicGSVTA/SOJTT0n8cRj166gwfACxVEyIsLa IfA8J2BA0w14LkYw3dK/dgbwZtXi1/xzkk1QNO9vf1M4QHwn5gQxrWCK2Xyie6bCnMBb Ngk3xV1vK9MAtoQvoXd1aaq4GJKhw1yXAY/HCrJA6JgpZdZXcuNmdwi38tYaltQcd+9+ msyg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1729153039; x=1729757839; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=vg7vd+fy/VzhW4y6/SWqvLzT/0RiOVGsypfe5+UKm/0=; b=pE63oJ1ri9IEDy4KL/GqX5RKWNorjqT76rF4WMES8OZDEOtWAuVxQj8o4YrawYv7mx a/5JelkiwnSjy3flcClyiMjRWfpLVvi6xgYCjO3q7jWWFQ9RKcxE2f/myjJQZEtPCTdw Yn4Fbj6E2R01VOUiHGkiRLcPkjhRoIdnMuvdH7T+kUXKIiHXuYBipMDJuP4OOtIGuw0f O5GeUojPHgmT2Hbe+O++DIERd7j2M72Rv7st/v2mmrHYwQA97/SXNttLtAF73a3yRy7f spnNi68M9Q0w9bcjRAlFlU2oi+sZ7Rqm/awLaDbe3y29XJZDzGDrV2CwfrrQMHrHEbjY RJbg== X-Forwarded-Encrypted: i=1; AJvYcCUkr2pQs4E2DHfXgGsVpIQKU5QPCT5TGzrVqsmbBuvfOfMf+eQVe53aJ5LUlML6iYRltXb9QZvndsl9JI6uEmb4/O1blg==@vger.kernel.org, AJvYcCWE0wEZqo/zn7I9ThM95T3ezjMJCqL+EKx9MmtBrn3kpuoo5QVXF+YHGL4Gr2KPVQf3xG0e9Qz/QovXzzk=@vger.kernel.org X-Gm-Message-State: AOJu0YzpWrBBKpN+bj3BhYzlX5tc2KsNA72/Op25qnUbRnKtAQz2eWtn uewgwb6g0tARvUDeEqGHdAdQFOyEDCCHjnm4U9CN9mCpNPUpVIaD X-Google-Smtp-Source: AGHT+IFZk/k+VKb1HMlKXhh84qODXbLqSodIV+3219ijitQb0DwyMVaz5QvDNyyNQn1syfDqz6+rcA== X-Received: by 2002:a05:6a20:2d22:b0:1d9:1783:6a2d with SMTP id adf61e73a8af0-1d917836bdemr5694242637.13.1729153038679; Thu, 17 Oct 2024 01:17:18 -0700 (PDT) Received: from localhost.localdomain (host95.181-12-202.telecom.net.ar. [181.12.202.95]) by smtp.gmail.com with ESMTPSA id d2e1a72fcca58-71e774cf125sm4208812b3a.155.2024.10.17.01.17.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 17 Oct 2024 01:17:18 -0700 (PDT) From: Kurt Borja To: kuurtb@gmail.com Cc: W_Armin@gmx.de, hdegoede@redhat.com, ilpo.jarvinen@linux.intel.com, linux-kernel@vger.kernel.org, platform-driver-x86@vger.kernel.org Subject: [PATCH v6 5/5] alienware-wmi: WMAX interface documentation Date: Thu, 17 Oct 2024 05:17:09 -0300 Message-ID: <20241017081708.127666-2-kuurtb@gmail.com> X-Mailer: git-send-email 2.47.0 In-Reply-To: <20241017081211.126214-2-kuurtb@gmail.com> References: <20241017081211.126214-2-kuurtb@gmail.com> Precedence: bulk X-Mailing-List: platform-driver-x86@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Added documentation for new WMAX interface, present on some Alienware X-Series, Alienware M-Series and Dell's G-Series laptops. Signed-off-by: Kurt Borja Reviewed-by: Armin Wolf --- v6: - Fixed typos - Included new file in MAINTAINERS --- Documentation/wmi/devices/alienware-wmi.rst | 366 ++++++++++++++++++++ MAINTAINERS | 1 + 2 files changed, 367 insertions(+) create mode 100644 Documentation/wmi/devices/alienware-wmi.rst diff --git a/Documentation/wmi/devices/alienware-wmi.rst b/Documentation/wmi/devices/alienware-wmi.rst new file mode 100644 index 000000000..f2fb845d7 --- /dev/null +++ b/Documentation/wmi/devices/alienware-wmi.rst @@ -0,0 +1,366 @@ +.. SPDX-License-Identifier: GPL-2.0-or-later + +============================================== +Dell AWCC WMI interface driver (alienware-wmi) +============================================== + +Introduction +============ + +The WMI device WMAX has been implemented for many Alienware and Dell's G-Series +models. Throughout these models, two implementations have been identified. The +first one, used by older systems, deals with HDMI, brightness, RGB, amplifier +and deep sleep control. The second one used by newer systems deals primarily +with thermal, overclocking, and GPIO control. + +It is suspected that the latter is used by Alienware Command Center (AWCC) to +manage manufacturer predefined thermal profiles. The alienware-wmi driver +exposes Thermal_Information and Thermal_Control methods through the Platform +Profile API to mimic AWCC's behavior. + +This newer interface, named AWCCMethodFunction has been reverse engineered, as +Dell has not provided any official documentation. We will try to describe to the +best of our ability its discovered inner workings. + +.. note:: + The following method description may vary between models. + +WMI interface description +------------------------- + +The WMI interface description can be decoded from the embedded binary MOF (bmof) +data using the `bmfdec `_ utility: + +:: + + [WMI, Dynamic, Provider("WmiProv"), Locale("MS\\0x409"), Description("WMI Function"), guid("{A70591CE-A997-11DA-B012-B622A1EF5492}")] + class AWCCWmiMethodFunction { + [key, read] string InstanceName; + [read] boolean Active; + + [WmiMethodId(13), Implemented, read, write, Description("Return Overclocking Report.")] void Return_OverclockingReport([out] uint32 argr); + [WmiMethodId(14), Implemented, read, write, Description("Set OCUIBIOS Control.")] void Set_OCUIBIOSControl([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(15), Implemented, read, write, Description("Clear OC FailSafe Flag.")] void Clear_OCFailSafeFlag([out] uint32 argr); + [WmiMethodId(19), Implemented, read, write, Description("Get Fan Sensors.")] void GetFanSensors([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(20), Implemented, read, write, Description("Thermal Information.")] void Thermal_Information([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(21), Implemented, read, write, Description("Thermal Control.")] void Thermal_Control([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(23), Implemented, read, write, Description("MemoryOCControl.")] void MemoryOCControl([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(26), Implemented, read, write, Description("System Information.")] void SystemInformation([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(28), Implemented, read, write, Description("Power Information.")] void PowerInformation([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(32), Implemented, read, write, Description("FW Update GPIO toggle.")] void FWUpdateGPIOtoggle([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(33), Implemented, read, write, Description("Read Total of GPIOs.")] void ReadTotalofGPIOs([out] uint32 argr); + [WmiMethodId(34), Implemented, read, write, Description("Read GPIO pin Status.")] void ReadGPIOpPinStatus([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(35), Implemented, read, write, Description("Read Chassis Color.")] void ReadChassisColor([out] uint32 argr); + [WmiMethodId(36), Implemented, read, write, Description("Read Platform Properties.")] void ReadPlatformProperties([out] uint32 argr); + [WmiMethodId(128), Implemented, read, write, Description("Caldera SW installation.")] void CalderaSWInstallation([out] uint32 argr); + [WmiMethodId(129), Implemented, read, write, Description("Caldera SW is released.")] void CalderaSWReleased([out] uint32 argr); + [WmiMethodId(130), Implemented, read, write, Description("Caldera Connection Status.")] void CalderaConnectionStatus([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(131), Implemented, read, write, Description("Surprise Unplugged Flag Status.")] void SurpriseUnpluggedFlagStatus([out] uint32 argr); + [WmiMethodId(132), Implemented, read, write, Description("Clear Surprise Unplugged Flag.")] void ClearSurpriseUnpluggedFlag([out] uint32 argr); + [WmiMethodId(133), Implemented, read, write, Description("Cancel Undock Request.")] void CancelUndockRequest([out] uint32 argr); + [WmiMethodId(135), Implemented, read, write, Description("Devices in Caldera.")] void DevicesInCaldera([in] uint32 arg2, [out] uint32 argr); + [WmiMethodId(136), Implemented, read, write, Description("Notify BIOS for SW ready to disconnect Caldera.")] void NotifyBIOSForSWReadyToDisconnectCaldera([out] uint32 argr); + [WmiMethodId(160), Implemented, read, write, Description("Tobii SW installation.")] void TobiiSWinstallation([out] uint32 argr); + [WmiMethodId(161), Implemented, read, write, Description("Tobii SW Released.")] void TobiiSWReleased([out] uint32 argr); + [WmiMethodId(162), Implemented, read, write, Description("Tobii Camera Power Reset.")] void TobiiCameraPowerReset([out] uint32 argr); + [WmiMethodId(163), Implemented, read, write, Description("Tobii Camera Power On.")] void TobiiCameraPowerOn([out] uint32 argr); + [WmiMethodId(164), Implemented, read, write, Description("Tobii Camera Power Off.")] void TobiiCameraPowerOff([out] uint32 argr); + }; + +Some of these methods get quite intricate so we will describe them using +pseudo-code that vaguely resembles the original ASL code. + +Argument Structure +------------------ + +All input arguments have type **uint32** and their structure is very similar +between methods. Usually, the first byte corresponds to a specific *operation* +the method performs, and the subsequent bytes correspond to *arguments* passed +to this *operation*. For example, if an operation has code 0x01 and requires an +ID 0xA0, the argument you would pass to the method is 0xA001. + + +Thermal Methods +=============== + +WMI method Thermal_Information([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------- + +:: + + if BYTE_0(arg2) == 0x01: + argr = 1 + + if BYTE_0(arg2) == 0x02: + argr = UNKNOWN_CONSTANT + + if BYTE_0(arg2) == 0x03: + if BYTE_1(arg2) == 0x00: + argr = FAN_ID_0 + + if BYTE_1(arg2) == 0x01: + argr = FAN_ID_1 + + if BYTE_1(arg2) == 0x02: + argr = FAN_ID_2 + + if BYTE_1(arg2) == 0x03: + argr = FAN_ID_3 + + if BYTE_1(arg2) == 0x04: + argr = SENSOR_ID_CPU | 0x0100 + + if BYTE_1(arg2) == 0x05: + argr = SENSOR_ID_GPU | 0x0100 + + if BYTE_1(arg2) == 0x06: + argr = THERMAL_MODE_QUIET_ID + + if BYTE_1(arg2) == 0x07: + argr = THERMAL_MODE_BALANCED_ID + + if BYTE_1(arg2) == 0x08: + argr = THERMAL_MODE_BALANCED_PERFORMANCE_ID + + if BYTE_1(arg2) == 0x09: + argr = THERMAL_MODE_PERFORMANCE_ID + + if BYTE_1(arg2) == 0x0A: + argr = THERMAL_MODE_LOW_POWER_ID + + if BYTE_1(arg2) == 0x0B: + argr = THERMAL_MODE_GMODE_ID + + else: + argr = 0xFFFFFFFF + + if BYTE_0(arg2) == 0x04: + if is_valid_sensor(BYTE_1(arg2)): + argr = SENSOR_TEMP_C + else: + argr = 0xFFFFFFFF + + if BYTE_0(arg2) == 0x05: + if is_valid_fan(BYTE_1(arg2)): + argr = FAN_RPM() + + if BYTE_0(arg2) == 0x06: + skip + + if BYTE_0(arg2) == 0x07: + argr = 0 + + If BYTE_0(arg2) == 0x08: + if is_valid_fan(BYTE_1(arg2)): + argr = 0 + else: + argr = 0xFFFFFFFF + + if BYTE_0(arg2) == 0x09: + if is_valid_fan(BYTE_1(arg2)): + argr = FAN_UNKNOWN_STAT_0() + + else: + argr = 0xFFFFFFFF + + if BYTE_0(arg2) == 0x0A: + argr = THERMAL_MODE_BALANCED_ID + + if BYTE_0(arg2) == 0x0B: + argr = CURRENT_THERMAL_MODE() + + if BYTE_0(arg2) == 0x0C: + if is_valid_fan(BYTE_1(arg2)): + argr = FAN_UNKNOWN_STAT_1() + else: + argr = 0xFFFFFFFF + +WMI method Thermal_Control([in] uint32 arg2, [out] uint32 argr) +--------------------------------------------------------------- + +:: + + if BYTE_0(arg2) == 0x01: + if is_valid_thermal_profile(BYTE_1(arg2)): + SET_THERMAL_PROFILE(BYTE_1(arg2)) + argr = 0 + + if BYTE_0(arg2) == 0x02: + if is_valid_fan(BYTE_1(arg2)): + SET_FAN_SPEED_MULTIPLIER(BYTE_2(arg2)) + argr = 0 + else: + argr = 0xFFFFFFFF + +.. note:: + While you can manually change the fan speed multiplier with this method, + Dell's BIOS tends to overwrite this changes anyway. + +These are the known thermal profile codes: + +:: + + CUSTOM 0x00 + + QUIET 0x96 + BALANCED 0x97 + BALANCED_PERFORMANCE 0x98 + PERFORMANCE 0x99 + + QUIET_USTT 0xA3 + BALANCED_USTT 0xA0 + BALANCED_PERFORMANCE_USTT 0xA1 + PERFORMANCE_USTT 0xA4 + LOW_POWER_USTT 0xA5 + + GMODE 0xAB + +Usually if a model doesn't support the first four profiles they will support +the User Selectable Thermal Tables (USTT) profiles and vice-versa. + +GMODE replaces PERFORMANCE in G-Series laptops. + +WMI method GetFanSensors([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------- + +:: + + if BYTE_0(arg2) == 1: + if is_valid_fan(BYTE_1(arg2)): + argr = 1 + else: + argr = 0 + + if BYTE_0(arg2) == 2: + if is_valid_fan(BYTE_1(arg2)): + if BYTE_2(arg2) == 0: + argr == SENSOR_ID + else + argr == 0xFFFFFFFF + else: + argr = 0 + +Overclocking Methods +==================== + +.. warning:: + These methods have not been tested and are only partially reverse + engineered. + +WMI method Return_OverclockingReport([out] uint32 argr) +------------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr = 0 + +CSMI is an unknown operation. + +WMI method Set_OCUIBIOSControl([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr = 0 + +CSMI is an unknown operation. + +WMI method Clear_OCFailSafeFlag([out] uint32 argr) +-------------------------------------------------- + +:: + + CSMI (0xE3, 0x99) + argr = 0 + +CSMI is an unknown operation. + + +WMI method MemoryOCControl([in] uint32 arg2, [out] uint32 argr) +--------------------------------------------------------------- + +AWCC supports memory overclocking, but this method is very intricate and has +not been deciphered yet. + +GPIO methods +============ + +These methods are probably related to some kind of firmware update system, +through a GPIO device. + +.. warning:: + These methods have not been tested and are only partially reverse + engineered. + +WMI method FWUpdateGPIOtoggle([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------ + +:: + + if BYTE_0(arg2) == 0: + if BYTE_1(arg2) == 1: + SET_PIN_A_HIGH() + else: + SET_PIN_A_LOW() + + if BYTE_0(arg2) == 1: + if BYTE_1(arg2) == 1: + SET_PIN_B_HIGH() + + else: + SET_PIN_B_LOW() + + else: + argr = 1 + +WMI method ReadTotalofGPIOs([out] uint32 argr) +---------------------------------------------- + +:: + + argr = 0x02 + +WMI method ReadGPIOpPinStatus([in] uint32 arg2, [out] uint32 argr) +------------------------------------------------------------------ + +:: + + if BYTE_0(arg2) == 0: + argr = PIN_A_STATUS + + if BYTE_0(arg2) == 1: + argr = PIN_B_STATUS + +Other information Methods +========================= + +WMI method SystemInformation([in] uint32 arg2, [out] uint32 argr) +----------------------------------------------------------------- + +Returns unknown information. + +WMI method PowerInformation([in] uint32 arg2, [out] uint32 argr) +---------------------------------------------------------------- + +Returns unknown information. + +WMI method ReadChassisColor([out] uint32 argr) +---------------------------------------------- + +:: + + argr = CHASSIS_COLOR_ID + +WMI method ReadPlatformProperties([out] uint32 argr) +---------------------------------------------------- + +Returns unknown information. + +Acknowledgements +================ + +Kudos to `AlexIII `_ for documenting +and testing available thermal profile codes. + diff --git a/MAINTAINERS b/MAINTAINERS index c27f31907..25f6de4c2 100644 --- a/MAINTAINERS +++ b/MAINTAINERS @@ -792,6 +792,7 @@ F: drivers/perf/alibaba_uncore_drw_pmu.c ALIENWARE WMI DRIVER L: Dell.Client.Kernel@dell.com S: Maintained +F: Documentation/wmi/devices/alienware-wmi.rst F: drivers/platform/x86/dell/alienware-wmi.c ALLEGRO DVT VIDEO IP CORE DRIVER